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

CorbaTransportManagerImpl

public class CorbaTransportManagerImpl extends Object implements com.sun.corba.se.spi.transport.CorbaTransportManager
author
Harold Carr

Fields Summary
protected com.sun.corba.se.spi.orb.ORB
orb
protected List
acceptors
protected Map
outboundConnectionCaches
protected Map
inboundConnectionCaches
protected com.sun.corba.se.pept.transport.Selector
selector
Constructors Summary
public CorbaTransportManagerImpl(com.sun.corba.se.spi.orb.ORB orb)

	this.orb = orb;
	acceptors = new ArrayList();
	outboundConnectionCaches = new HashMap();
	inboundConnectionCaches = new HashMap();
	selector = new SelectorImpl(orb);
    
Methods Summary
public voidaddToIORTemplate(com.sun.corba.se.spi.ior.IORTemplate iorTemplate, com.sun.corba.se.impl.oa.poa.Policies policies, java.lang.String codebase, java.lang.String objectAdapterManagerId, com.sun.corba.se.spi.ior.ObjectAdapterId objectAdapterId)

	Iterator iterator = 
	    getAcceptors(objectAdapterManagerId, objectAdapterId).iterator();
	while (iterator.hasNext()) {
	    CorbaAcceptor acceptor = (CorbaAcceptor) iterator.next();
	    acceptor.addToIORTemplate(iorTemplate, policies, codebase);
	}
    
public voidclose()

	try {
	    if (orb.transportDebugFlag) {
		dprint(".close->");
	    }
	    getSelector(0).close();
	} finally {
	    if (orb.transportDebugFlag) {
		dprint(".close<-");
	    }
	}
    
protected voiddprint(java.lang.String msg)

	ORBUtility.dprint("CorbaTransportManagerImpl", msg);
    
public java.util.CollectiongetAcceptors(java.lang.String objectAdapterManagerId, com.sun.corba.se.spi.ior.ObjectAdapterId objectAdapterId)

	// REVISIT - need to filter based on arguments.

	// REVISIT - initialization will be moved to OA.
	// Lazy initialization of acceptors.
	Iterator iterator = acceptors.iterator();
	while (iterator.hasNext()) {
	    Acceptor acceptor = (Acceptor) iterator.next();
	    if (acceptor.initialize()) {
		if (acceptor.shouldRegisterAcceptEvent()) {
		    orb.getTransportManager().getSelector(0)
			.registerForEvent(acceptor.getEventHandler());
		}
	    }
	}
	return acceptors;
    
public java.util.CollectiongetAcceptors()

	return getAcceptors(null, null);
    
public com.sun.corba.se.pept.transport.ByteBufferPoolgetByteBufferPool(int id)

	throw new RuntimeException(); 
    
public com.sun.corba.se.pept.transport.InboundConnectionCachegetInboundConnectionCache(com.sun.corba.se.pept.transport.Acceptor acceptor)

	synchronized (acceptor) {
	    if (acceptor.getConnectionCache() == null) {
		InboundConnectionCache connectionCache = null;
		synchronized (inboundConnectionCaches) {
		    connectionCache = (InboundConnectionCache)
			inboundConnectionCaches.get(
                            acceptor.getConnectionCacheType());
		    if (connectionCache == null) {
			// REVISIT: Would like to be able to configure
			// the connection cache type used.
			connectionCache = 
			    new CorbaInboundConnectionCacheImpl(orb,
								acceptor);
			inboundConnectionCaches.put(
                            acceptor.getConnectionCacheType(),
			    connectionCache);
		    }
		}
		acceptor.setConnectionCache(connectionCache);
	    }
	    return acceptor.getConnectionCache();
	}
    
public java.util.CollectiongetInboundConnectionCaches()

	return inboundConnectionCaches.values();
    
public com.sun.corba.se.pept.transport.OutboundConnectionCachegetOutboundConnectionCache(com.sun.corba.se.pept.transport.ContactInfo contactInfo)

	synchronized (contactInfo) {
	    if (contactInfo.getConnectionCache() == null) {
		OutboundConnectionCache connectionCache = null;
		synchronized (outboundConnectionCaches) {
		    connectionCache = (OutboundConnectionCache)
			outboundConnectionCaches.get(
                            contactInfo.getConnectionCacheType());
		    if (connectionCache == null) {
			// REVISIT: Would like to be able to configure
			// the connection cache type used.
			connectionCache = 
			    new CorbaOutboundConnectionCacheImpl(orb,
								 contactInfo);
			outboundConnectionCaches.put(
                            contactInfo.getConnectionCacheType(),
			    connectionCache);
		    }
		}
		contactInfo.setConnectionCache(connectionCache);
	    }
	    return contactInfo.getConnectionCache();
	}
    
public java.util.CollectiongetOutboundConnectionCaches()

	return outboundConnectionCaches.values();
    
public com.sun.corba.se.pept.transport.SelectorgetSelector(int id)

	return selector;
    
public synchronized voidregisterAcceptor(com.sun.corba.se.pept.transport.Acceptor acceptor)

	if (orb.transportDebugFlag) {
	    dprint(".registerAcceptor->: " + acceptor);
	}
	acceptors.add(acceptor);
	if (orb.transportDebugFlag) {
	    dprint(".registerAcceptor<-: " + acceptor);
	}
    
public synchronized voidunregisterAcceptor(com.sun.corba.se.pept.transport.Acceptor acceptor)

	acceptors.remove(acceptor);