jaguar.beans.enterprise.SharedObjects interface

Description

package com.sybase.jaguar.beans.enterprise;
public interface SharedObjects

Interface to support sharing data between instances of the same component.

Constructors

None. See InstanceContext.getSharedObjects(), ServerBean.activate(InstanceContext, String).

Methods

See also

jaguar.beans.enterprise.InstanceContext interface




SharedObjects.get(int)

Description

Retrieve the value of a property.

Syntax

Package

com.sybase.jaguar.beans.enterprise

Interface

SharedObjects

public abstract Object get
            (int index)
            throws SharedObjectException;

Parameters

index

An arbitrary integer that identifies the property from which you want to retrieve the value.

Usage

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.

See also

set(int, Object), lock(int), lockNoWait(int), unlock(int)




SharedObjects.lock(int)

Description

Place an advisory lock on a property.

Syntax

Package

com.sybase.jaguar.beans.enterprise

Interface

SharedObjects

public abstract void lock
            (int index)
            throws SharedObjectException;

Parameters

index

An integer that identifies the property you want to lock.

Usage

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.

See also

lockNoWait(int), unlock(int), get(int), set(int, Object)




SharedObjects.lockNoWait(int)

Description

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.

Syntax

Package

com.sybase.jaguar.beans.enterprise

Interface

SharedObjects

public abstract void lockNoWait
            (int index)
            throws SharedObjectException;

Parameters

index

An integer that identifies the property you want to lock.

Usage

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.

See also

lock(int), unlock(int), get(int), set(int, Object)




SharedObjects.set(int, Object)

Description

Set the value of a property.

Syntax

Package

com.sybase.jaguar.beans.enterprise

Interface

SharedObjects

public abstract Object set
            (int index)
            Object obj)
           throws SharedObjectException;

Parameters

index

An integer that identifies the property for which you want to set a value.

obj

An object containing the new property value.

Usage

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.

See also

get(int), lock(int), lockNoWait(int), unlock(int)




SharedObjects.unlock(int)

Description

Unlock a property locked by the same instance executing the unlock method.

Syntax

Package

com.sybase.jaguar.beans.enterprise

Interface

SharedObjects

public abstract void unlock
            (int index)
            throws SharedObjectException

Parameters

index

An integer that identifies the property to be locked.

Usage

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.

See also

lock(int), lockNoWait(int), get(int), set(int, Object)