package com.sybase.jaguar.beans.enterprise;
public interface SharedObjects
Interface to support sharing data between instances of the same component.
None. See InstanceContext.getSharedObjects(), ServerBean.activate(InstanceContext, String).
get(int) – Retrieve the value of a property.
lock(int) – Place an advisory lock on a property.
lockNoWait(int) – Place an advisory lock on a property. If the property is currently locked, do not wait for the current lock to be released and execution immediately returns to the calling method.
set(int, Object) – Set the value of a property.
unlock(int) - Unlock a property locked by the same instance executing the unlock method.
jaguar.beans.enterprise.InstanceContext interface
Retrieve the value of a property.
Package |
|
Interface |
public abstract Object get (int index) throws SharedObjectException;
An arbitrary integer that identifies the property from which you want to retrieve the value.
To retrieve a property value, retrieve an object reference to the property using the get method and then assign the object reference to a variable with the desired datatype. If the property has not been initialized, the property and variable are initialized to null.
Executing a single get method on a property is atomic. Atomic means that an operation on data will complete before any other operations can access that data.
set(int, Object), lock(int), lockNoWait(int), unlock(int)
Place an advisory lock on a property.
Package |
|
Interface |
public abstract void lock (int index) throws SharedObjectException;
An integer that identifies the property you want to lock.
Use the lock method in combination with the lockNoWait and unlock methods to synchronize multiple updates to and reads from the same property value. The lock method places an advisory lock on a property. An advisory lock prevents another instance from locking the property but does not prevent another instance from using the get and set methods to retrieve and update the property value. If the property is currently locked, the lock method waits for the current lock to be released.
You must lock a property before using the get or set method
to retrieve or update the property value. When you lock a property
that has not been set, the property is created and its value is
initialized to null
. You can
lock the same property more than once as long as all locks are executed
from the same component instance. However, these multiple locks
are not iterative and you only have to unlock the property once.
lockNoWait(int), unlock(int), get(int), set(int, Object)
Place an advisory lock on a property. If the property is currently locked, do not wait for the current lock to be released and execution immediately returns to the calling method.
Package |
|
Interface |
public abstract void lockNoWait (int index) throws SharedObjectException;
An integer that identifies the property you want to lock.
Use the lockNoWait method in combination with the lock and unlock methods to synchronize multiple updates to and reads from the same property value. The lockNoWait method places an advisory lock on a property. An advisory lock prevents another instance from locking the property but does not prevent another instance from using the get and set methods to retrieve and update the property value. If the property is currently locked, the lockNoWait method does not wait for the current lock to be released and execution immediately returns to the calling method.
You must lock a property before using the get or set method
to retrieve or update the property value. When you lock a property
that has not been set, the property is created and its value is
initialized to null
. You can
lock the same property more than once as long as all locks are executed
from the same component instance. However, these multiple locks
are not iterative and you only have to unlock the property once.
lock(int), unlock(int), get(int), set(int, Object)
Set the value of a property.
Package |
|
Interface |
public abstract Object set (int index) Object obj) throws SharedObjectException;
An integer that identifies the property for which you want to set a value.
An object containing the new property value.
To set a property value, assign a value an object and pass that object as the obj parameter in the set method.
Executing a single set method on a property is atomic. That is, the call will complete before any other operations can access the property being set.
get(int), lock(int), lockNoWait(int), unlock(int)
Unlock a property locked by the same instance executing the unlock method.
Package |
|
Interface |
public abstract void unlock (int index) throws SharedObjectException
An integer that identifies the property to be locked.
Use the unlock method in combination with the lock and lockNoWait methods to synchronize multiple updates to and reads from the same property value. The unlock method releases an advisory lock on a property that has been locked by the instance executing the unlock method. An advisory lock prevents another instance from locking the property but does not prevent another instance from using the get and set methods to retrieve and update the property value.
You can unlock a property that has not been set. Even if a property has been locked more than once, you only have to unlock the property once.
lock(int), lockNoWait(int), get(int), set(int, Object)
Copyright © 2005. Sybase Inc. All rights reserved. |