Obtain lock on replicated Geode region - geode

Im using Geode/Gemfire Peer-to-Peer topology with a replicated region. I want this region to be refreshed every X hrs. I think this will require some locking on the region to ensure members dont refresh within X hrs.
Few observations/questions:
Locking is available only on Scope.GLOBAL regions but my region is Scope.DISTRIBUTED_ACK. I can change my region to be Scope.GLOBAL but what is the difference between the two?
Another way to achieve what I want: Create another region (with only one entry with key lastRefreshAt and value an Instant) that I can get a lock on (this region will be Scope.GLOBAL). Member after getting the lock will check if lastRefreshAt < X hrs, if true, refresh and release lock. This will allow me keep my original region as Scope.DISTRIBUTED_ACK.
Last but not least, how to obtain the lock on a region. Im using SDG (Spring Data Geode).
Thank you and Im open for other suggestions.

Related

How to create orders for picking process at warehouse operations using Anylogic

During the creation of a generalized warehouse model, I ran into a problem when trying to create an order event that can be used by order pickers to retrieve the products from the storages racks. Currently, I am using a source block which creates "orders" of a single type of pallet (1 to 5). The pickers each travel to pick up a pallet from the rack and transports them to the next location.
Question: How can I create an order consisting out of several pallets consisting of different types.
Question: How can I use a single picker (resource) to pick multiple pallets in a single run through the warehouse before transporting all the pallets to the next location (process).
Kind regards,
Stefan
Question 1
normally i would create a class for the higher level order (say Pickwave class).
And when instantiating it you need to save a list of actual picking orders(pallets) into it (say collection of type ArrayList<Order>).
And to process your pickwave you can use a loop which will steer your resource/transporter/picker to the next Order location until all orders are picked. If everything is picked you exit your loop and move to your next location
Question 2
you don't really pick the orders as you would normally pick them using RackPick block in 1-to-1 scenario. But as you have a refence to all your orders inside you pickwave object you can still control their location/animation programmatically.

How to change shift group size of resource pool dynamically during simulation in anylogic?

I am trying to use anylogic to model labor shortage in production. I have the workers set as a resource pool with the capacity defined using shift plan, defining the number of workers by different shift. I am trying to include a event module that changes labor capacity for each shift during the middle of simulation. However, anylogic showed me an error saying I cannot change shift group size dynamically. Is there any workaround to allow this to happen? Thank you.
You can recreate the schedule within an event each time you need to perform a change.
AnyLogic's API explains this quite well, see https://help.anylogic.com/index.jsp?topic=%2Fcom.anylogic.help%2Fhtml%2Fdata%2FSchedule_API.html (sample model or 'creating and initializing schedule programmatically on model startup')

How to mark a object for deletion in x days time?

I have a regional object store. I would like to be able to tell a particular object that I want you deleted in 5 days time from now.
How do you suggest I implement?
I don't really want to keep track of the object in a database, and based on time send delete commands as a separate process. Is there any tag that could be set to get deletion to occur at a later time (from now, not a specific time in the past)?
There's no functionality built into Google Cloud Storage to do this.
You can configure Lifecycle Management to delete objects according to a number of criteria (including age) - but deleting at a particular date in the future isn't one of the supported conditions and in fact there's no guarantee that a lifecycle condition will run the same day the condition becomes true. Instead you would have to implement this functionality yourself (e.g., in a Compute Engine or App Engine implementation).

Moving one agent within another agent in Anylogic

I am making simple distribution center in Anylogic.I did make truck agent and i am able to move it from one gis point to another gis point.
But I want to load some other agents(Let's say banana agent) into my truck agent and then trucks start their journey(if truck is full of banana).How can i do this?
I hope you have already solved your problem from almost a year ago. However, since there is no specific answer, I'll leave it here for anyone who might get stuck with the same problem.
Anylogic's Process Modelling Library (PML) has an element called Pickup and its opposite, Dropoff. This is used to do exactly what you asked: to load some element into a transporter (either a truck, a forklift, or even a person).
To use the block as you asked you would need a topology like in the picture:
The Queue elements are necessary to hold elements until the pickup occurs.
The Pickup element might pick elements in three modes:
While a given condition is True;
An exact amount (if available);
All available agents.
I'm assuming all trucks must be completely filled up to its maximum capacity. Hence, the chosen mode will be the second one where the exact amount will be TruckCapacity, a parameter of agent Truck.
The selected mode picks up agents (in this case Bananas) up to the desired amount. However, if nothing is available or the present amount is inferior to the desired, the native behavior of the Pickup block is to allow the container element to simply go through it and pick only what's available.
To prevent such behavior, I've created a restricted area where only 1 Truck can be at a time. Additionally, the Hold block WaitFullyLoaded (set to initially blocked) forces the container agent Truck to be fully loaded. Whenever a Banana enters the Queue waitTruck, a verification is performed to check if 1 Truck can be filled. If so, allows passage for that one truck:
if(self.size()/TruckCapacity>=1){
WaitFullyLoaded.unblock();
}
To block WaitFullyLoaded again, when the truck passes through the restrictedAreaEnd block, it performs WaitFullyLoaded.block();
The main idea is this. However, many features can be added and changed.
Hope this helps,
Luís

What are the differences between region and prefered location of an Cloud SQL instance?

Editing an instance, we can see two inputs as below snapshot about region and about location.
How would we distinguish the two?
Within a region, there are multiple physical locations your instance can be. By setting your Preferred Location, your instance will come up in the same location as an App Engine or Google Compute Engine instance. This will minimize latency between your Cloud SQL instance and the othe AE/GCE instance.
Additionally, your Cloud SQL instance will follow the instance you've tied it to, so they will both locate next to each other, even if your AE/GCE instance moves.
If you don't care, you can leave Preferred Location to None.