FileDocCategorySizeDatePackage
CorbaInboundConnectionCacheImpl.javaAPI DocJava SE 5 API5169Fri Aug 26 14:54:32 BST 2005com.sun.corba.se.impl.transport

CorbaInboundConnectionCacheImpl

public class CorbaInboundConnectionCacheImpl extends CorbaConnectionCacheBase implements com.sun.corba.se.pept.transport.InboundConnectionCache
author
Harold Carr

Fields Summary
protected Collection
connectionCache
Constructors Summary
public CorbaInboundConnectionCacheImpl(com.sun.corba.se.spi.orb.ORB orb, com.sun.corba.se.pept.transport.Acceptor acceptor)

	super(orb, acceptor.getConnectionCacheType(),
	      ((CorbaAcceptor)acceptor).getMonitoringName());
	this.connectionCache = new ArrayList();
    
Methods Summary
protected java.lang.ObjectbackingStore()

	return connectionCache;
    
protected voiddprint(java.lang.String msg)

	ORBUtility.dprint("CorbaInboundConnectionCacheImpl", msg);
    
public com.sun.corba.se.pept.transport.Connectionget(com.sun.corba.se.pept.transport.Acceptor acceptor)

	throw wrapper.methodShouldNotBeCalled();
    
public voidput(com.sun.corba.se.pept.transport.Acceptor acceptor, com.sun.corba.se.pept.transport.Connection connection)

	if (orb.transportDebugFlag) {
	    dprint(".put: " + acceptor + " " + connection);
	}
	synchronized (backingStore()) {
	    connectionCache.add(connection);
	    connection.setConnectionCache(this);
	    dprintStatistics();
	}
    
protected voidregisterWithMonitoring()

	// ORB
	MonitoredObject orbMO = 
	    orb.getMonitoringManager().getRootMonitoredObject();

	// REVISIT - add ORBUtil mkdir -p like operation for this.

	// CONNECTION
	MonitoredObject connectionMO = 
	    orbMO.getChild(MonitoringConstants.CONNECTION_MONITORING_ROOT);
	if (connectionMO == null) {
	    connectionMO = 
		MonitoringFactories.getMonitoredObjectFactory()
		    .createMonitoredObject(
		        MonitoringConstants.CONNECTION_MONITORING_ROOT,
			MonitoringConstants.CONNECTION_MONITORING_ROOT_DESCRIPTION);
	    orbMO.addChild(connectionMO);
	}

	// INBOUND CONNECTION
	MonitoredObject inboundConnectionMO = 
	    connectionMO.getChild(
                MonitoringConstants.INBOUND_CONNECTION_MONITORING_ROOT);
	if (inboundConnectionMO == null) {
	    inboundConnectionMO =
		MonitoringFactories.getMonitoredObjectFactory()
		    .createMonitoredObject(
		        MonitoringConstants.INBOUND_CONNECTION_MONITORING_ROOT,
			MonitoringConstants.INBOUND_CONNECTION_MONITORING_ROOT_DESCRIPTION);
	    connectionMO.addChild(inboundConnectionMO);
	}

	// NODE FOR THIS CACHE
	MonitoredObject thisMO = 
	    inboundConnectionMO.getChild(getMonitoringName());
	if (thisMO == null) {
	    thisMO =
		MonitoringFactories.getMonitoredObjectFactory()
		    .createMonitoredObject(
		        getMonitoringName(),
			MonitoringConstants.CONNECTION_MONITORING_DESCRIPTION);
	    inboundConnectionMO.addChild(thisMO);
	}

	LongMonitoredAttributeBase attribute;

	// ATTRIBUTE
	attribute = new 
	    LongMonitoredAttributeBase(
                MonitoringConstants.CONNECTION_TOTAL_NUMBER_OF_CONNECTIONS, 
		MonitoringConstants.CONNECTION_TOTAL_NUMBER_OF_CONNECTIONS_DESCRIPTION)
	    {
		public Object getValue() {
		    return new Long(CorbaInboundConnectionCacheImpl.this.numberOfConnections());
		}
	    };
	thisMO.addAttribute(attribute);

	// ATTRIBUTE
	attribute = new 
	    LongMonitoredAttributeBase(
                MonitoringConstants.CONNECTION_NUMBER_OF_IDLE_CONNECTIONS, 
		MonitoringConstants.CONNECTION_NUMBER_OF_IDLE_CONNECTIONS_DESCRIPTION)
	    {
		public Object getValue() {
		    return new Long(CorbaInboundConnectionCacheImpl.this.numberOfIdleConnections());
		}
	    };
	thisMO.addAttribute(attribute);

	// ATTRIBUTE
	attribute = new 
	    LongMonitoredAttributeBase(
                MonitoringConstants.CONNECTION_NUMBER_OF_BUSY_CONNECTIONS, 
		MonitoringConstants.CONNECTION_NUMBER_OF_BUSY_CONNECTIONS_DESCRIPTION)
	    {
		public Object getValue() {
		    return new Long(CorbaInboundConnectionCacheImpl.this.numberOfBusyConnections());
		}
	    };
	thisMO.addAttribute(attribute);
    
public voidremove(com.sun.corba.se.pept.transport.Connection connection)

	if (orb.transportDebugFlag) {
	    dprint(".remove: " +  connection);
	}
	synchronized (backingStore()) {
	    connectionCache.remove(connection);
	    dprintStatistics();
	}
    
public java.util.Collectionvalues()

	return connectionCache;