I'm using Google's Java API to work with Google Cloud Storage (GCS).
I have multiple worker threads that insert objects into GCS. Currently they share a common Storage
instance, and use this to create Storage.Object.Insert
instances:
synchronized(LOCK)
{
insertObject = mStorage.objects().insert(mBucketName, objectMetadata, mediaContent);
}
They later call execute()
on the Insert
instance, uploading a file to GCS.
insertObject.execute();
My question is can I run the execute()
call concurrently in different threads? The Insert
object is unique to that thread, but the Storage
object it was created with is shared between threads, so I'm worried this may cause problems.
Thanks in advance!