com.sun.corba.se.pept.transport.Connection Java Examples

The following examples show how to use com.sun.corba.se.pept.transport.Connection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BufferManagerWriteStream.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void sendFragment(boolean isLastFragment)
{
    Connection conn = ((OutputObject)outputObject).getMessageMediator().getConnection();

    // REVISIT: need an ORB
    //System.out.println("sendFragment: last?: " + isLastFragment);
    conn.writeLock();

    try {
        // Send the fragment
        conn.sendWithoutLock(((OutputObject)outputObject));

        fragmentCount++;

    } finally {

        conn.writeUnlock();
    }

}
 
Example #2
Source File: SharedCDRContactInfoImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public MessageMediator createMessageMediator(Broker broker,
                                             ContactInfo contactInfo,
                                             Connection connection,
                                             String methodName,
                                             boolean isOneWay)
{
    if (connection != null) {
        /// XXX LOGGING
        throw new RuntimeException("connection is not null");
    }

    CorbaMessageMediator messageMediator =
        new CorbaMessageMediatorImpl(
            (ORB) broker,
            contactInfo,
            null, // Connection;
            GIOPVersion.chooseRequestVersion( (ORB)broker,
                 effectiveTargetIOR),
            effectiveTargetIOR,
            requestId++, // Fake RequestId
            getAddressingDisposition(),
            methodName,
            isOneWay);

    return messageMediator;
}
 
Example #3
Source File: CorbaContactInfoBase.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public MessageMediator createMessageMediator(Broker broker,
                                             ContactInfo contactInfo,
                                             Connection connection,
                                             String methodName,
                                             boolean isOneWay)
{
    // REVISIT: Would like version, ior, requestid, etc., decisions
    // to be in client subcontract.  Cannot pass these to this
    // factory method because it breaks generic abstraction.
    // Maybe set methods on mediator called from subcontract
    // after creation?
    CorbaMessageMediator messageMediator =
        new CorbaMessageMediatorImpl(
            (ORB) broker,
            contactInfo,
            connection,
            GIOPVersion.chooseRequestVersion( (ORB)broker,
                 effectiveTargetIOR),
            effectiveTargetIOR,
            ((CorbaConnection)connection).getNextRequestId(),
            getAddressingDisposition(),
            methodName,
            isOneWay);

    return messageMediator;
}
 
Example #4
Source File: SharedCDRContactInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public MessageMediator createMessageMediator(Broker broker,
                                             ContactInfo contactInfo,
                                             Connection connection,
                                             String methodName,
                                             boolean isOneWay)
{
    if (connection != null) {
        /// XXX LOGGING
        throw new RuntimeException("connection is not null");
    }

    CorbaMessageMediator messageMediator =
        new CorbaMessageMediatorImpl(
            (ORB) broker,
            contactInfo,
            null, // Connection;
            GIOPVersion.chooseRequestVersion( (ORB)broker,
                 effectiveTargetIOR),
            effectiveTargetIOR,
            requestId++, // Fake RequestId
            getAddressingDisposition(),
            methodName,
            isOneWay);

    return messageMediator;
}
 
Example #5
Source File: CorbaContactInfoBase.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public MessageMediator createMessageMediator(Broker broker,
                                             ContactInfo contactInfo,
                                             Connection connection,
                                             String methodName,
                                             boolean isOneWay)
{
    // REVISIT: Would like version, ior, requestid, etc., decisions
    // to be in client subcontract.  Cannot pass these to this
    // factory method because it breaks generic abstraction.
    // Maybe set methods on mediator called from subcontract
    // after creation?
    CorbaMessageMediator messageMediator =
        new CorbaMessageMediatorImpl(
            (ORB) broker,
            contactInfo,
            connection,
            GIOPVersion.chooseRequestVersion( (ORB)broker,
                 effectiveTargetIOR),
            effectiveTargetIOR,
            ((CorbaConnection)connection).getNextRequestId(),
            getAddressingDisposition(),
            methodName,
            isOneWay);

    return messageMediator;
}
 
Example #6
Source File: CorbaContactInfoBase.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public MessageMediator createMessageMediator(Broker broker,
                                             ContactInfo contactInfo,
                                             Connection connection,
                                             String methodName,
                                             boolean isOneWay)
{
    // REVISIT: Would like version, ior, requestid, etc., decisions
    // to be in client subcontract.  Cannot pass these to this
    // factory method because it breaks generic abstraction.
    // Maybe set methods on mediator called from subcontract
    // after creation?
    CorbaMessageMediator messageMediator =
        new CorbaMessageMediatorImpl(
            (ORB) broker,
            contactInfo,
            connection,
            GIOPVersion.chooseRequestVersion( (ORB)broker,
                 effectiveTargetIOR),
            effectiveTargetIOR,
            ((CorbaConnection)connection).getNextRequestId(),
            getAddressingDisposition(),
            methodName,
            isOneWay);

    return messageMediator;
}
 
Example #7
Source File: BufferManagerWriteStream.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private void sendFragment(boolean isLastFragment)
{
    Connection conn = ((OutputObject)outputObject).getMessageMediator().getConnection();

    // REVISIT: need an ORB
    //System.out.println("sendFragment: last?: " + isLastFragment);
    conn.writeLock();

    try {
        // Send the fragment
        conn.sendWithoutLock(((OutputObject)outputObject));

        fragmentCount++;

    } finally {

        conn.writeUnlock();
    }

}
 
Example #8
Source File: CorbaContactInfoBase.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public MessageMediator finishCreatingMessageMediator(Broker broker,
                           Connection conn, MessageMediator messageMediator)
{
    ORB orb = (ORB) broker;
    CorbaConnection connection = (CorbaConnection) conn;
    CorbaMessageMediator corbaMessageMediator =
                  (CorbaMessageMediator)messageMediator;

    if (orb.transportDebugFlag) {
        dprint(
        ".finishCreatingMessageMediator: waiting for message body on connection: "
            + connection);
    }

    Message msg = corbaMessageMediator.getDispatchHeader();
    msg.setByteBuffer(corbaMessageMediator.getDispatchBuffer());

    // read giop body only
    msg = MessageBase.readGIOPBody(orb, connection, msg);

    ByteBuffer byteBuffer = msg.getByteBuffer();
    msg.setByteBuffer(null);
    corbaMessageMediator.setDispatchHeader(msg);
    corbaMessageMediator.setDispatchBuffer(byteBuffer);

    return corbaMessageMediator;
}
 
Example #9
Source File: CorbaInboundConnectionCacheImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void remove(Connection connection)
{
    if (orb.transportDebugFlag) {
        dprint(".remove: " +  connection);
    }
    synchronized (backingStore()) {
        connectionCache.remove(connection);
        dprintStatistics();
    }
}
 
Example #10
Source File: SocketOrChannelAcceptorImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public MessageMediator finishCreatingMessageMediator(Broker broker,
                                                     Connection connection,
                                                     MessageMediator messageMediator)
{
    // REVISIT - no factoring so cheat to avoid code dup right now.
    // REVISIT **** COUPLING !!!!
    ContactInfo contactInfo = new SocketOrChannelContactInfoImpl();
    return contactInfo.finishCreatingMessageMediator(broker,
                                      connection, messageMediator);
}
 
Example #11
Source File: CorbaConnectionCacheBase.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public long numberOfBusyConnections()
{
    long count = 0;
    synchronized (backingStore()) {
        Iterator connections = values().iterator();
        while (connections.hasNext()) {
            if (((Connection)connections.next()).isBusy()) {
                count++;
            }
        }
    }
    return count;
}
 
Example #12
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public CorbaMessageMediatorImpl(ORB orb,
                                Connection connection)
{
    this.orb = orb;
    this.connection = (CorbaConnection)connection;
    this.wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    this.interceptorWrapper = InterceptorsSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
}
 
Example #13
Source File: CorbaOutboundConnectionCacheImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public Connection get(ContactInfo contactInfo)
{
    if (orb.transportDebugFlag) {
        dprint(".get: " + contactInfo + " " + contactInfo.hashCode());
    }
    synchronized (backingStore()) {
        dprintStatistics();
        return (Connection) connectionCache.get(contactInfo);
    }
}
 
Example #14
Source File: CorbaContactInfoBase.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public MessageMediator createMessageMediator(Broker broker,Connection conn)
{
    ORB orb = (ORB) broker;
    CorbaConnection connection = (CorbaConnection) conn;

    if (orb.transportDebugFlag) {
        if (connection.shouldReadGiopHeaderOnly()) {
            dprint(
            ".createMessageMediator: waiting for message header on connection: "
            + connection);
        } else {
            dprint(
            ".createMessageMediator: waiting for message on connection: "
            + connection);
        }
    }

    Message msg = null;

    if (connection.shouldReadGiopHeaderOnly()) {
        // read giop header only
        msg = MessageBase.readGIOPHeader(orb, connection);
    } else {
        // read entire giop message
        msg = MessageBase.readGIOPMessage(orb, connection);
    }

    ByteBuffer byteBuffer = msg.getByteBuffer();
    msg.setByteBuffer(null);
    CorbaMessageMediator messageMediator =
        new CorbaMessageMediatorImpl(orb, connection, msg, byteBuffer);

    return messageMediator;
}
 
Example #15
Source File: ReaderThreadImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public ReaderThreadImpl(ORB orb,
                        Connection connection, Selector selector)
{
    this.orb = orb;
    this.connection = connection;
    this.selector = selector;
    keepRunning = true;
}
 
Example #16
Source File: CorbaInboundConnectionCacheImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void put(Acceptor acceptor, Connection connection)
{
    if (orb.transportDebugFlag) {
        dprint(".put: " + acceptor + " " + connection);
    }
    synchronized (backingStore()) {
        connectionCache.add(connection);
        connection.setConnectionCache(this);
        dprintStatistics();
    }
}
 
Example #17
Source File: CorbaMessageMediatorImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public CorbaMessageMediatorImpl(ORB orb,
                                Connection connection)
{
    this.orb = orb;
    this.connection = (CorbaConnection)connection;
    this.wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    this.interceptorWrapper = InterceptorsSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
}
 
Example #18
Source File: CorbaInboundConnectionCacheImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void put(Acceptor acceptor, Connection connection)
{
    if (orb.transportDebugFlag) {
        dprint(".put: " + acceptor + " " + connection);
    }
    synchronized (backingStore()) {
        connectionCache.add(connection);
        connection.setConnectionCache(this);
        dprintStatistics();
    }
}
 
Example #19
Source File: CorbaOutboundConnectionCacheImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Connection get(ContactInfo contactInfo)
{
    if (orb.transportDebugFlag) {
        dprint(".get: " + contactInfo + " " + contactInfo.hashCode());
    }
    synchronized (backingStore()) {
        dprintStatistics();
        return (Connection) connectionCache.get(contactInfo);
    }
}
 
Example #20
Source File: CorbaContactInfoBase.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public MessageMediator finishCreatingMessageMediator(Broker broker,
                           Connection conn, MessageMediator messageMediator)
{
    ORB orb = (ORB) broker;
    CorbaConnection connection = (CorbaConnection) conn;
    CorbaMessageMediator corbaMessageMediator =
                  (CorbaMessageMediator)messageMediator;

    if (orb.transportDebugFlag) {
        dprint(
        ".finishCreatingMessageMediator: waiting for message body on connection: "
            + connection);
    }

    Message msg = corbaMessageMediator.getDispatchHeader();
    msg.setByteBuffer(corbaMessageMediator.getDispatchBuffer());

    // read giop body only
    msg = MessageBase.readGIOPBody(orb, connection, msg);

    ByteBuffer byteBuffer = msg.getByteBuffer();
    msg.setByteBuffer(null);
    corbaMessageMediator.setDispatchHeader(msg);
    corbaMessageMediator.setDispatchBuffer(byteBuffer);

    return corbaMessageMediator;
}
 
Example #21
Source File: SocketOrChannelAcceptorImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public MessageMediator createMessageMediator(Broker broker,
                                             Connection connection)
{
    // REVISIT - no factoring so cheat to avoid code dup right now.
    // REVISIT **** COUPLING !!!!
    ContactInfo contactInfo = new SocketOrChannelContactInfoImpl();
    return contactInfo.createMessageMediator(broker, connection);
}
 
Example #22
Source File: ReaderThreadImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public ReaderThreadImpl(ORB orb,
                        Connection connection, Selector selector)
{
    this.orb = orb;
    this.connection = connection;
    this.selector = selector;
    keepRunning = true;
}
 
Example #23
Source File: SocketOrChannelAcceptorImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public MessageMediator finishCreatingMessageMediator(Broker broker,
                                                     Connection connection,
                                                     MessageMediator messageMediator)
{
    // REVISIT - no factoring so cheat to avoid code dup right now.
    // REVISIT **** COUPLING !!!!
    ContactInfo contactInfo = new SocketOrChannelContactInfoImpl();
    return contactInfo.finishCreatingMessageMediator(broker,
                                      connection, messageMediator);
}
 
Example #24
Source File: CorbaMessageMediatorImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public CorbaMessageMediatorImpl(ORB orb,
                                ContactInfo contactInfo,
                                Connection connection,
                                GIOPVersion giopVersion,
                                IOR ior,
                                int requestId,
                                short addrDisposition,
                                String operationName,
                                boolean isOneWay)
{
    this( orb, connection ) ;

    this.contactInfo = (CorbaContactInfo) contactInfo;
    this.addrDisposition = addrDisposition;

    streamFormatVersion =
        getStreamFormatVersionForThisRequest(
            ((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR(),
            giopVersion);
    streamFormatVersionSet = true;

    requestHeader = (RequestMessage) MessageBase.createRequest(
        this.orb,
        giopVersion,
        ORBUtility.getEncodingVersion(orb, ior),
        requestId,
        !isOneWay,
        ((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR(),
        this.addrDisposition,
        operationName,
        new ServiceContexts(orb),
        null);
}
 
Example #25
Source File: CorbaMessageMediatorImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public CorbaMessageMediatorImpl(ORB orb,
                                Connection connection)
{
    this.orb = orb;
    this.connection = (CorbaConnection)connection;
    this.wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    this.interceptorWrapper = InterceptorsSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
}
 
Example #26
Source File: SocketFactoryContactInfoImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public Connection createConnection()
{
    Connection connection =
        new SocketFactoryConnectionImpl(
            orb, this,
            orb.getORBData().connectionSocketUseSelectThreadToWait(),
            orb.getORBData().connectionSocketUseWorkerThreadForEvent());
    return connection;
}
 
Example #27
Source File: CorbaConnectionCacheBase.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public long numberOfIdleConnections()
{
    long count = 0;
    synchronized (backingStore()) {
        Iterator connections = values().iterator();
        while (connections.hasNext()) {
            if (! ((Connection)connections.next()).isBusy()) {
                count++;
            }
        }
    }
    return count;
}
 
Example #28
Source File: CorbaContactInfoBase.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public MessageMediator createMessageMediator(Broker broker,Connection conn)
{
    ORB orb = (ORB) broker;
    CorbaConnection connection = (CorbaConnection) conn;

    if (orb.transportDebugFlag) {
        if (connection.shouldReadGiopHeaderOnly()) {
            dprint(
            ".createMessageMediator: waiting for message header on connection: "
            + connection);
        } else {
            dprint(
            ".createMessageMediator: waiting for message on connection: "
            + connection);
        }
    }

    Message msg = null;

    if (connection.shouldReadGiopHeaderOnly()) {
        // read giop header only
        msg = MessageBase.readGIOPHeader(orb, connection);
    } else {
        // read entire giop message
        msg = MessageBase.readGIOPMessage(orb, connection);
    }

    ByteBuffer byteBuffer = msg.getByteBuffer();
    msg.setByteBuffer(null);
    CorbaMessageMediator messageMediator =
        new CorbaMessageMediatorImpl(orb, connection, msg, byteBuffer);

    return messageMediator;
}
 
Example #29
Source File: SocketOrChannelContactInfoImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public Connection createConnection()
{
    Connection connection =
        new SocketOrChannelConnectionImpl(orb, this,
                                          socketType, hostname, port);
    return connection;
}
 
Example #30
Source File: CorbaMessageMediatorImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public CorbaMessageMediatorImpl(ORB orb,
                                Connection connection)
{
    this.orb = orb;
    this.connection = (CorbaConnection)connection;
    this.wrapper = ORBUtilSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
    this.interceptorWrapper = InterceptorsSystemException.get( orb,
        CORBALogDomains.RPC_PROTOCOL ) ;
}