FileDocCategorySizeDatePackage
PICurrent.javaAPI DocJava SE 5 API4519Fri Aug 26 14:54:22 BST 2005com.sun.corba.se.impl.interceptors

PICurrent

public class PICurrent extends org.omg.CORBA.LocalObject implements org.omg.PortableInterceptor.Current
PICurrent is the implementation of Current as specified in the Portable Interceptors Spec orbos/99-12-02. IMPORTANT: PICurrent is implemented with the assumption that get_slot() or set_slot() will not be called in ORBInitializer.pre_init() and post_init().

Fields Summary
private int
slotCounter
private com.sun.corba.se.spi.orb.ORB
myORB
private com.sun.corba.se.impl.logging.OMGSystemException
wrapper
private boolean
orbInitializing
private ThreadLocal
threadLocalSlotTable
Constructors Summary
PICurrent(com.sun.corba.se.spi.orb.ORB myORB)
PICurrent constructor which will be called for every ORB initialization.


                    
        
	this.myORB = myORB;
	wrapper = OMGSystemException.get( myORB, 
	    CORBALogDomains.RPC_PROTOCOL ) ;
	this.orbInitializing = true;
        slotCounter = 0;
    
Methods Summary
intallocateSlotId()
This method will be called from ORBInitInfo.allocate_slot_id( ). simply returns a slot id by incrementing slotCounter.

        int slotId = slotCounter;
        slotCounter = slotCounter + 1;
        return slotId;
    
SlotTablegetSlotTable()
This method gets the SlotTable which is on the top of the ThreadLocalStack.

        SlotTable table = (SlotTable)
                ((SlotTableStack)threadLocalSlotTable.get()).peekSlotTable();
        return table;
    
public org.omg.CORBA.Anyget_slot(int id)
This method gets the slot data at the given slot id (index) from the Slot Table which is on the top of the SlotTableStack.

	if( orbInitializing ) {
	    // As per ptc/00-08-06 if the ORB is still initializing, disallow
	    // calls to get_slot and set_slot.  If an attempt is made to call,
	    // throw a BAD_INV_ORDER.
	    throw wrapper.invalidPiCall4() ;
	}

        return getSlotTable().get_slot( id );
    
voidpopSlotTable()
This method pops a SlotTable on the SlotTableStack.

        SlotTableStack st = (SlotTableStack)threadLocalSlotTable.get();
        st.popSlotTable( );
    
voidpushSlotTable()
This method pushes a SlotTable on the SlotTableStack. When there is a resolve_initial_references("PICurrent") after this call. The new PICurrent will be returned.

        SlotTableStack st = (SlotTableStack)threadLocalSlotTable.get();
        st.pushSlotTable( );
    
voidresetSlotTable()
This method resets all the slot data to null in the Slot Table which is on the top of SlotTableStack.

        getSlotTable().resetSlots();
    
voidsetORBInitializing(boolean init)
Called from ORB when the ORBInitializers are about to start initializing.

	this.orbInitializing = init;
    
public voidset_slot(int id, org.omg.CORBA.Any data)
This method sets the slot data at the given slot id (index) in the Slot Table which is on the top of the SlotTableStack.

	if( orbInitializing ) {
	    // As per ptc/00-08-06 if the ORB is still initializing, disallow
	    // calls to get_slot and set_slot.  If an attempt is made to call,
	    // throw a BAD_INV_ORDER.
	    throw wrapper.invalidPiCall3() ;
	}

        getSlotTable().set_slot( id, data );