Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serializable service factory #168

Closed

Conversation

mziccard
Copy link
Contributor

This PR follows the discussion in #55.
It adds a ServiceFactory interface for service factories that extends Serializable.
A factory() getter is also added to the Service interface and implemented in the BaseService class.

Adding a Serializable ServiceFactory, as well as adding the factory() getter to the Service interface is not mandatory for having #55. It would have been enough to make StorageFactory serializable and add factory() getter to StorageService only. I did this bigger PR:

  1. To maintain consistency across service interfaces
  2. Because I think we might need a factory() getter also in other services, for the same reasons discussed in Should Blobs and Buckets be stateless or keep a reference to a StorageService ? #55

If anybody thinks these are too many changes, we can avoid merging this and I will make a Serializable factory only for StorageService.
Feedback is more than appreciated:)

/cc @aozarov @jgeewax @ajkannan

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 21, 2015
public interface ServiceFactory<
ServiceT extends Service,
OptionsT extends ServiceOptions<?, OptionsT>>
extends Serializable {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@aozarov
Copy link
Contributor

aozarov commented Sep 21, 2015

@eamonnmcmanus given a serialize factory and serializable options we can always re-construct an instance of a service.

I think that can help us in many cases especially we want to provide a "continuous/lazy" functionality which in many cases is represented as a collection of serializable data (that is lazily created by the service).

This may open up a bigger discussion if we want our data holders to be serializable (issue #109) but
I would rather get more opinions about that if possible. I understand that Serialization could be nasty
but I still feel that it is kind of expected from plain data structure (considering the JDK itself and many
other libraries). In addition I didn't see much harm or future complication by requiring the factory to
be serializable but maybe I overlooked possible issues?

public abstract class DatastoreFactory {
public abstract class DatastoreFactory implements ServiceFactory<Datastore, DatastoreOptions> {

private static final long serialVersionUID = 5037190305022535983L;

private static final DatastoreFactory INSTANCE = new DatastoreFactory() {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@aozarov
Copy link
Contributor

aozarov commented Sep 21, 2015

@mziccard Sure, I am fine with putting this on hold and using an interface for ListResult as you proposed in #55. I suspect that if we do go head with this PR then it only means dropping one implementation of ListResutl, right?

SeriviceOptions is already serializable. Personally, I don't see a problem with a serialize factory.
Having both factory + options serializable means that we have an easy way to re-create a service at any point. I can think various use-cases for this being useful but supporting AE and being able to replace appengine_gcs_client is the one that I am currently have in mind. This one needs to be able to support functionality that starts in one process and resumable by other[s]. However, @eamonnmcmanus if you are not comfortable with that or even with the fact that data objects are serializable we can hold on with that for now (as @mziccard suggested).

@mziccard
Copy link
Contributor Author

@aozarov We might still need the two implementations of ListResult, where in one we implement the lazy serialization of functional Blob list while in the other we just rely on default serialization. At least I cannot think of a way of doing this with a single class, correct me if I'm wrong.

@aozarov
Copy link
Contributor

aozarov commented Sep 22, 2015

@mziccard I think the same implementation of ListResult could be used by providing different implementation for the Iterable<T> results param. One just returns BlobInfo and the other lazily converts BlobInfo into Blob per Iterator#next calls.

@mziccard
Copy link
Contributor Author

@aozarov You are right 👍

@aozarov
Copy link
Contributor

aozarov commented Oct 29, 2015

@mziccard I think we can close this one, right?

@mziccard mziccard closed this Oct 29, 2015
@mziccard mziccard deleted the serializable-service-factory branch October 29, 2015 12:55
github-actions bot pushed a commit to suztomo/google-cloud-java that referenced this pull request Jun 29, 2022
…is#168)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [com.google.api:api-common](https://togithub.com/googleapis/api-common-java) | patch | `1.9.0` -> `1.9.1` |

---

### Release Notes

<details>
<summary>googleapis/api-common-java</summary>

### [`v1.9.1`](https://togithub.com/googleapis/api-common-java/releases/v1.9.1)

[Compare Source](https://togithub.com/googleapis/api-common-java/compare/v1.9.0...v1.9.1)

#### Bug Fixes

-   support complex resource identifiers ([#&googleapis#8203;125](https://togithub.com/googleapis/api-common-java/pull/125))

##### Dependencies

-   Update dependency com.google.auto.value:auto-value-annotations to v1.7.2 ([#&googleapis#8203;136](https://togithub.com/googleapis/api-common-java/pull/136))
-   Update dependency com.google.auto.value:auto-value to v1.7.2 ([#&googleapis#8203;135](https://togithub.com/googleapis/api-common-java/pull/135))

</details>

---

### Renovate configuration

:date: **Schedule**: At any time (no schedule defined).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/java-resourcemanager).
github-actions bot pushed a commit to suztomo/google-cloud-java that referenced this pull request Jun 29, 2022
🤖 I have created a release \*beep\* \*boop\* 
---
## [0.118.0](https://www.github.com/googleapis/java-resourcemanager/compare/v0.117.2...v0.118.0) (2020-08-10)


### Features

* expose apis of resourcemanager folders ([googleapis#99](https://www.github.com/googleapis/java-resourcemanager/issues/99)) ([5187637](https://www.github.com/googleapis/java-resourcemanager/commit/51876371e0be10ed7531127d04cfca0ee4b410ca))
* implement testPermission api of organizations ([googleapis#125](https://www.github.com/googleapis/java-resourcemanager/issues/125)) ([a80889f](https://www.github.com/googleapis/java-resourcemanager/commit/a80889f947d6e190bfd80e8cf02586a38f235409))
* **deps:** adopt flatten plugin and google-cloud-shared-dependencies ([googleapis#191](https://www.github.com/googleapis/java-resourcemanager/issues/191)) ([b505081](https://www.github.com/googleapis/java-resourcemanager/commit/b50508137a3c009269371d91b3bbf4145db08818))


### Dependencies

* update core dependencies ([googleapis#133](https://www.github.com/googleapis/java-resourcemanager/issues/133)) ([ae2003e](https://www.github.com/googleapis/java-resourcemanager/commit/ae2003e7c8633018e02e53fb489de726330bcda5))
* update core dependencies to v1.93.3 ([googleapis#104](https://www.github.com/googleapis/java-resourcemanager/issues/104)) ([35528d1](https://www.github.com/googleapis/java-resourcemanager/commit/35528d155264781bc51dab542acd76452e6e0f72))
* update dependency com.google.api:api-common to v1.9.0 ([googleapis#120](https://www.github.com/googleapis/java-resourcemanager/issues/120)) ([54a5f79](https://www.github.com/googleapis/java-resourcemanager/commit/54a5f793cbfe08c20cbd6f00edf120727673343e))
* update dependency com.google.api:api-common to v1.9.1 ([googleapis#168](https://www.github.com/googleapis/java-resourcemanager/issues/168)) ([44ad341](https://www.github.com/googleapis/java-resourcemanager/commit/44ad341f2d81c46b0020e66d8a2c636ab095cc92))
* update dependency com.google.api:api-common to v1.9.2 ([googleapis#174](https://www.github.com/googleapis/java-resourcemanager/issues/174)) ([cfbba2f](https://www.github.com/googleapis/java-resourcemanager/commit/cfbba2f40fe142265c9be0316cafc06256fdc0e8))
* update dependency com.google.api:gax-bom to v1.55.0 ([googleapis#124](https://www.github.com/googleapis/java-resourcemanager/issues/124)) ([d4ded56](https://www.github.com/googleapis/java-resourcemanager/commit/d4ded56efaffbf0477f781270a618521239e50b2))
* update dependency com.google.apis:google-api-services-cloudresourcemanager to v1-rev20200311-1.30.9 ([googleapis#100](https://www.github.com/googleapis/java-resourcemanager/issues/100)) ([25d0ade](https://www.github.com/googleapis/java-resourcemanager/commit/25d0ade06c0f2f7bb2702b4f832e65aad0f90b34))
* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.8.2 ([googleapis#204](https://www.github.com/googleapis/java-resourcemanager/issues/204)) ([fe0af27](https://www.github.com/googleapis/java-resourcemanager/commit/fe0af2737f2463d2452ac05dd3edc452f50b99d6))
* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.8.4 ([googleapis#206](https://www.github.com/googleapis/java-resourcemanager/issues/206)) ([61a40c6](https://www.github.com/googleapis/java-resourcemanager/commit/61a40c6865e435e36910bc2f5b1da64be1813a60))
* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.8.6 ([googleapis#212](https://www.github.com/googleapis/java-resourcemanager/issues/212)) ([7ce8ce2](https://www.github.com/googleapis/java-resourcemanager/commit/7ce8ce24f83d84b7962557f968d92325343ee094))
* update dependency com.google.guava:guava-bom to v29 ([googleapis#138](https://www.github.com/googleapis/java-resourcemanager/issues/138)) ([4fc1bb3](https://www.github.com/googleapis/java-resourcemanager/commit/4fc1bb3b085d5847b00476c7e52fa36113c75eb6))
* update dependency com.google.http-client:google-http-client-bom to v1.35.0 ([googleapis#156](https://www.github.com/googleapis/java-resourcemanager/issues/156)) ([3b628c8](https://www.github.com/googleapis/java-resourcemanager/commit/3b628c86b9047f048ccb93e220958e7e72e87e0f))
* update dependency com.google.protobuf:protobuf-bom to v3.12.0 ([googleapis#162](https://www.github.com/googleapis/java-resourcemanager/issues/162)) ([d07a72d](https://www.github.com/googleapis/java-resourcemanager/commit/d07a72de5ab5918a688a9ad1a1b0a125f9b6db07))
* update dependency com.google.protobuf:protobuf-bom to v3.12.2 ([googleapis#166](https://www.github.com/googleapis/java-resourcemanager/issues/166)) ([43a221e](https://www.github.com/googleapis/java-resourcemanager/commit/43a221e6b5584188ae55d320d7a6dbeed78dbd1f))
* update dependency org.threeten:threetenbp to v1.4.2 ([googleapis#112](https://www.github.com/googleapis/java-resourcemanager/issues/112)) ([2ef23e8](https://www.github.com/googleapis/java-resourcemanager/commit/2ef23e853af809847e7b323fd3dd6a651b323cc1))
* update dependency org.threeten:threetenbp to v1.4.3 ([googleapis#131](https://www.github.com/googleapis/java-resourcemanager/issues/131)) ([5669f1e](https://www.github.com/googleapis/java-resourcemanager/commit/5669f1e70092181c1ab8e1f9e12dad9feb2ea787))
* update dependency org.threeten:threetenbp to v1.4.4 ([googleapis#155](https://www.github.com/googleapis/java-resourcemanager/issues/155)) ([ac8a2a2](https://www.github.com/googleapis/java-resourcemanager/commit/ac8a2a24c68c5264dc90b90bcdb3bfd0adfa51df))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please).
github-actions bot pushed a commit that referenced this pull request Jul 6, 2022
…transfer to v1.2.0 (#168)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:google-cloud-storage-transfer](https://togithub.com/googleapis/java-storage-transfer) | `1.1.0` -> `1.2.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-storage-transfer/1.2.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-storage-transfer/1.2.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-storage-transfer/1.2.0/compatibility-slim/1.1.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-storage-transfer/1.2.0/confidence-slim/1.1.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/java-storage-transfer</summary>

### [`v1.2.0`](https://togithub.com/googleapis/java-storage-transfer/blob/HEAD/CHANGELOG.md#&#8203;120-httpsgithubcomgoogleapisjava-storage-transfercomparev110v120-2022-07-01)

[Compare Source](https://togithub.com/googleapis/java-storage-transfer/compare/v1.1.0...v1.2.0)

##### Features

-   Enable REST transport for most of Java and Go clients ([#&#8203;159](https://togithub.com/googleapis/java-storage-transfer/issues/159)) ([484473a](https://togithub.com/googleapis/java-storage-transfer/commit/484473ab9ec00dcbd557f0a95fb3ad9d6396c49d))

##### Bug Fixes

-   update gapic-generator-java with mock service generation fixes ([#&#8203;162](https://togithub.com/googleapis/java-storage-transfer/issues/162)) ([5b46c0c](https://togithub.com/googleapis/java-storage-transfer/commit/5b46c0cf3c311821344c90b12521d789e86a58bb))

##### Dependencies

-   update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 ([#&#8203;158](https://togithub.com/googleapis/java-storage-transfer/issues/158)) ([8e48e49](https://togithub.com/googleapis/java-storage-transfer/commit/8e48e4944e8e346bebc8cad811e3772537be96a3))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-storage-transfer).
github-actions bot pushed a commit that referenced this pull request Sep 15, 2022
🤖 I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
github-actions bot pushed a commit that referenced this pull request Oct 4, 2022
🤖 I have created a release *beep* *boop*
---


## [1.1.7](https://togithub.com/googleapis/java-deploy/compare/v1.1.6...v1.1.7) (2022-10-03)


### Dependencies

* Update dependency certifi to v2022.9.24 ([#167](https://togithub.com/googleapis/java-deploy/issues/167)) ([829bf37](https://togithub.com/googleapis/java-deploy/commit/829bf37cb0aa03b8533cd67815a34f61c17d3526))
* Update dependency charset-normalizer to v2.1.1 ([#172](https://togithub.com/googleapis/java-deploy/issues/172)) ([4384f86](https://togithub.com/googleapis/java-deploy/commit/4384f86bab95d6ca92665f38cbe1f0eba07246e6))
* Update dependency click to v8.1.3 ([#173](https://togithub.com/googleapis/java-deploy/issues/173)) ([6330f0f](https://togithub.com/googleapis/java-deploy/commit/6330f0f79535e798287797a4ba3fdcf67ff08fcb))
* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.4 ([#188](https://togithub.com/googleapis/java-deploy/issues/188)) ([04183a8](https://togithub.com/googleapis/java-deploy/commit/04183a80c3c0c5ca711831683cf90f835af833ae))
* Update dependency gcp-releasetool to v1.8.8 ([#168](https://togithub.com/googleapis/java-deploy/issues/168)) ([3b8fa48](https://togithub.com/googleapis/java-deploy/commit/3b8fa480774fce03c6d692ba7acb5d9884dfd163))
* Update dependency google-api-core to v2.10.1 ([#174](https://togithub.com/googleapis/java-deploy/issues/174)) ([9631b06](https://togithub.com/googleapis/java-deploy/commit/9631b06317b18ec92030f534f065a722e2f4bc3b))
* Update dependency google-auth to v2.11.1 ([#169](https://togithub.com/googleapis/java-deploy/issues/169)) ([d059772](https://togithub.com/googleapis/java-deploy/commit/d0597727fb4df93e34558dc9d3d889a0bf6cdfd6))
* Update dependency google-cloud-core to v2.3.2 ([#170](https://togithub.com/googleapis/java-deploy/issues/170)) ([c9ce18c](https://togithub.com/googleapis/java-deploy/commit/c9ce18cd60c968d4fd5d78fb6e798fda22ca891e))
* Update dependency google-cloud-storage to v2.5.0 ([#175](https://togithub.com/googleapis/java-deploy/issues/175)) ([7258e5c](https://togithub.com/googleapis/java-deploy/commit/7258e5ceaeb60f67a17d597fe0fa24bea28a56f7))
* Update dependency google-crc32c to v1.5.0 ([#176](https://togithub.com/googleapis/java-deploy/issues/176)) ([41f6b20](https://togithub.com/googleapis/java-deploy/commit/41f6b20a67820a90f24af40f724710c1f30c9621))
* Update dependency googleapis-common-protos to v1.56.4 ([#171](https://togithub.com/googleapis/java-deploy/issues/171)) ([15f6e3b](https://togithub.com/googleapis/java-deploy/commit/15f6e3bec2261ead4cd0486d33d549d18b5d8c4b))
* Update dependency importlib-metadata to v4.12.0 ([#177](https://togithub.com/googleapis/java-deploy/issues/177)) ([2d69170](https://togithub.com/googleapis/java-deploy/commit/2d691702d957c2aa5ed7f18b941970a410f1feec))
* Update dependency markupsafe to v2.1.1 ([#178](https://togithub.com/googleapis/java-deploy/issues/178)) ([48e29ef](https://togithub.com/googleapis/java-deploy/commit/48e29efbf0fd29b66d5b282dca7245832d7e847b))
* Update dependency protobuf to v3.20.2 ([#179](https://togithub.com/googleapis/java-deploy/issues/179)) ([10265fc](https://togithub.com/googleapis/java-deploy/commit/10265fca9c2291f90a07ed0c296b56632c685fa5))
* Update dependency pyjwt to v2.5.0 ([#180](https://togithub.com/googleapis/java-deploy/issues/180)) ([2dab9fa](https://togithub.com/googleapis/java-deploy/commit/2dab9fa5ca31952563312a59e0cddea26a9ef7b0))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
github-actions bot pushed a commit that referenced this pull request Oct 4, 2022
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 477955264

Source-Link: https://togithub.com/googleapis/googleapis/commit/a724450af76d0001f23602684c49cd6a4b3a5654

Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/4abcbcaec855e74a0b22a4988cf9e0eb61a83094
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGFiY2JjYWVjODU1ZTc0YTBiMjJhNDk4OGNmOWUwZWI2MWE4MzA5NCJ9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: core cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants