Java Code Examples for javax.rmi.CORBA.Tie

The following are top voted examples for showing how to use javax.rmi.CORBA.Tie. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: StubAdapter.java   View source code 6 votes vote down vote up
/** Given any Tie, return the corresponding object refernce, activating
 * the Servant if necessary.
 */
public static org.omg.CORBA.Object activateTie( Tie tie )
{
    /** Any implementation of Tie should be either a Servant or an ObjectImpl,
     * depending on which style of code generation is used.  rmic -iiop by
     * default results in an ObjectImpl-based Tie, while rmic -iiop -poa
     * results in a Servant-based Tie.  Dynamic RMI-IIOP also uses Servant-based
     * Ties (see impl.presentation.rmi.ReflectiveTie).
     */
    if (tie instanceof ObjectImpl) {
        return tie.thisObject() ;
    } else if (tie instanceof Servant) {
        Servant servant = (Servant)tie ;
        return activateServant( servant ) ;
    } else {
        throw wrapper.badActivateTieCall() ;
    }
}
 
Example 2
Project: OpenJSharp   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * Deregisters a server object from the runtime, allowing the object to become
 * available for garbage collection.
 * @param obj the object to unexport.
 * @exception NoSuchObjectException if the remote object is not
 * currently exported.
 */
public void unexportObject(Remote obj)
    throws NoSuchObjectException {

    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    if (StubAdapter.isStub(obj) ||
        obj instanceof java.rmi.server.RemoteStub) {
        throw new NoSuchObjectException(
            "Can only unexport a server object.");
    }

    Tie theTie = Util.getTie(obj);
    if (theTie != null) {
        Util.unexportObject(obj);
    } else {
        if (Utility.loadTie(obj) == null) {
            UnicastRemoteObject.unexportObject(obj,true);
        } else {
            throw new NoSuchObjectException("Object not exported.");
        }
    }
}
 
Example 3
Project: OpenJSharp   File: Util.java   View source code 6 votes vote down vote up
public void unregisterTargetsForORB(org.omg.CORBA.ORB orb)
{
    for (Enumeration e = exportedServants.keys(); e.hasMoreElements(); )
    {
        java.lang.Object key = e.nextElement();
        Remote target = (Remote)(key instanceof Tie ? ((Tie)key).getTarget() : key);

        // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set.
        // We can ignore this because it means the tie is not connected to an ORB.
        try {
            if (orb == getTie(target).orb()) {
                try {
                    unexportObject(target);
                } catch( java.rmi.NoSuchObjectException ex ) {
                    // We neglect this exception if at all if it is
                    // raised. It is not harmful.
                }
            }
        } catch (BAD_OPERATION bad) {
            /* Ignore */
        }
    }
}
 
Example 4
Project: OpenJSharp   File: Util.java   View source code 6 votes vote down vote up
/**
 * Registers a target for a tie. Adds the tie to an internal table and calls
 * {@link Tie#setTarget} on the tie object.
 * @param tie the tie to register.
 * @param target the target for the tie.
 */
public void registerTarget(javax.rmi.CORBA.Tie tie, java.rmi.Remote target)
{
    synchronized (exportedServants) {
        // Do we already have this target registered?
        if (lookupTie(target) == null) {
            // No, so register it and set the target...
            exportedServants.put(target,tie);
            tie.setTarget(target);

            // Do we need to instantiate our keep-alive thread?
            if (keepAlive == null) {
                // Yes. Instantiate our keep-alive thread and start
                // it up...
                keepAlive = (KeepAlive)AccessController.doPrivileged(new PrivilegedAction() {
                    public java.lang.Object run() {
                        return new KeepAlive();
                    }
                });
                keepAlive.start();
            }
        }
    }
}
 
Example 5
Project: openjdk-jdk10   File: StubAdapter.java   View source code 6 votes vote down vote up
/** Given any Tie, return the corresponding object refernce, activating
 * the Servant if necessary.
 */
public static org.omg.CORBA.Object activateTie( Tie tie )
{
    /** Any implementation of Tie should be either a Servant or an ObjectImpl,
     * depending on which style of code generation is used.  rmic -iiop by
     * default results in an ObjectImpl-based Tie, while rmic -iiop -poa
     * results in a Servant-based Tie.  Dynamic RMI-IIOP also uses Servant-based
     * Ties (see impl.presentation.rmi.ReflectiveTie).
     */
    if (tie instanceof ObjectImpl) {
        return tie.thisObject() ;
    } else if (tie instanceof Servant) {
        Servant servant = (Servant)tie ;
        return activateServant( servant ) ;
    } else {
        throw wrapper.badActivateTieCall() ;
    }
}
 
Example 6
Project: openjdk-jdk10   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * Deregisters a server object from the runtime, allowing the object to become
 * available for garbage collection.
 * @param obj the object to unexport.
 * @exception NoSuchObjectException if the remote object is not
 * currently exported.
 */
public void unexportObject(Remote obj)
    throws NoSuchObjectException {

    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    if (StubAdapter.isStub(obj) ||
        obj instanceof java.rmi.server.RemoteStub) {
        throw new NoSuchObjectException(
            "Can only unexport a server object.");
    }

    Tie theTie = Util.getTie(obj);
    if (theTie != null) {
        Util.unexportObject(obj);
    } else {
        if (Utility.loadTie(obj) == null) {
            UnicastRemoteObject.unexportObject(obj,true);
        } else {
            throw new NoSuchObjectException("Object not exported.");
        }
    }
}
 
Example 7
Project: openjdk-jdk10   File: Util.java   View source code 6 votes vote down vote up
public void unregisterTargetsForORB(org.omg.CORBA.ORB orb)
{
    for (Enumeration e = exportedServants.keys(); e.hasMoreElements(); )
    {
        java.lang.Object key = e.nextElement();
        Remote target = (Remote)(key instanceof Tie ? ((Tie)key).getTarget() : key);

        // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set.
        // We can ignore this because it means the tie is not connected to an ORB.
        try {
            if (orb == getTie(target).orb()) {
                try {
                    unexportObject(target);
                } catch( java.rmi.NoSuchObjectException ex ) {
                    // We neglect this exception if at all if it is
                    // raised. It is not harmful.
                }
            }
        } catch (BAD_OPERATION bad) {
            /* Ignore */
        }
    }
}
 
Example 8
Project: openjdk-jdk10   File: Util.java   View source code 6 votes vote down vote up
/**
 * Registers a target for a tie. Adds the tie to an internal table and calls
 * {@link Tie#setTarget} on the tie object.
 * @param tie the tie to register.
 * @param target the target for the tie.
 */
public void registerTarget(javax.rmi.CORBA.Tie tie, java.rmi.Remote target)
{
    synchronized (exportedServants) {
        // Do we already have this target registered?
        if (lookupTie(target) == null) {
            // No, so register it and set the target...
            exportedServants.put(target,tie);
            tie.setTarget(target);

            // Do we need to instantiate our keep-alive thread?
            if (keepAlive == null) {
                // Yes. Instantiate our keep-alive thread and start
                // it up...
                keepAlive = (KeepAlive)AccessController.doPrivileged(new PrivilegedAction() {
                    public java.lang.Object run() {
                        return new KeepAlive();
                    }
                });
                keepAlive.start();
            }
        }
    }
}
 
Example 9
Project: openjdk9   File: StubAdapter.java   View source code 6 votes vote down vote up
/** Given any Tie, return the corresponding object refernce, activating
 * the Servant if necessary.
 */
public static org.omg.CORBA.Object activateTie( Tie tie )
{
    /** Any implementation of Tie should be either a Servant or an ObjectImpl,
     * depending on which style of code generation is used.  rmic -iiop by
     * default results in an ObjectImpl-based Tie, while rmic -iiop -poa
     * results in a Servant-based Tie.  Dynamic RMI-IIOP also uses Servant-based
     * Ties (see impl.presentation.rmi.ReflectiveTie).
     */
    if (tie instanceof ObjectImpl) {
        return tie.thisObject() ;
    } else if (tie instanceof Servant) {
        Servant servant = (Servant)tie ;
        return activateServant( servant ) ;
    } else {
        throw wrapper.badActivateTieCall() ;
    }
}
 
Example 10
Project: openjdk9   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * Deregisters a server object from the runtime, allowing the object to become
 * available for garbage collection.
 * @param obj the object to unexport.
 * @exception NoSuchObjectException if the remote object is not
 * currently exported.
 */
public void unexportObject(Remote obj)
    throws NoSuchObjectException {

    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    if (StubAdapter.isStub(obj) ||
        obj instanceof java.rmi.server.RemoteStub) {
        throw new NoSuchObjectException(
            "Can only unexport a server object.");
    }

    Tie theTie = Util.getTie(obj);
    if (theTie != null) {
        Util.unexportObject(obj);
    } else {
        if (Utility.loadTie(obj) == null) {
            UnicastRemoteObject.unexportObject(obj,true);
        } else {
            throw new NoSuchObjectException("Object not exported.");
        }
    }
}
 
Example 11
Project: openjdk9   File: Util.java   View source code 6 votes vote down vote up
public void unregisterTargetsForORB(org.omg.CORBA.ORB orb)
{
    for (Enumeration e = exportedServants.keys(); e.hasMoreElements(); )
    {
        java.lang.Object key = e.nextElement();
        Remote target = (Remote)(key instanceof Tie ? ((Tie)key).getTarget() : key);

        // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set.
        // We can ignore this because it means the tie is not connected to an ORB.
        try {
            if (orb == getTie(target).orb()) {
                try {
                    unexportObject(target);
                } catch( java.rmi.NoSuchObjectException ex ) {
                    // We neglect this exception if at all if it is
                    // raised. It is not harmful.
                }
            }
        } catch (BAD_OPERATION bad) {
            /* Ignore */
        }
    }
}
 
Example 12
Project: openjdk9   File: Util.java   View source code 6 votes vote down vote up
/**
 * Registers a target for a tie. Adds the tie to an internal table and calls
 * {@link Tie#setTarget} on the tie object.
 * @param tie the tie to register.
 * @param target the target for the tie.
 */
public void registerTarget(javax.rmi.CORBA.Tie tie, java.rmi.Remote target)
{
    synchronized (exportedServants) {
        // Do we already have this target registered?
        if (lookupTie(target) == null) {
            // No, so register it and set the target...
            exportedServants.put(target,tie);
            tie.setTarget(target);

            // Do we need to instantiate our keep-alive thread?
            if (keepAlive == null) {
                // Yes. Instantiate our keep-alive thread and start
                // it up...
                keepAlive = (KeepAlive)AccessController.doPrivileged(new PrivilegedAction() {
                    public java.lang.Object run() {
                        return new KeepAlive();
                    }
                });
                keepAlive.start();
            }
        }
    }
}
 
Example 13
Project: lookaside_java-1.8.0-openjdk   File: StubAdapter.java   View source code 6 votes vote down vote up
/** Given any Tie, return the corresponding object refernce, activating
 * the Servant if necessary.
 */
public static org.omg.CORBA.Object activateTie( Tie tie )
{
    /** Any implementation of Tie should be either a Servant or an ObjectImpl,
     * depending on which style of code generation is used.  rmic -iiop by
     * default results in an ObjectImpl-based Tie, while rmic -iiop -poa
     * results in a Servant-based Tie.  Dynamic RMI-IIOP also uses Servant-based
     * Ties (see impl.presentation.rmi.ReflectiveTie).
     */
    if (tie instanceof ObjectImpl) {
        return tie.thisObject() ;
    } else if (tie instanceof Servant) {
        Servant servant = (Servant)tie ;
        return activateServant( servant ) ;
    } else {
        throw wrapper.badActivateTieCall() ;
    }
}
 
Example 14
Project: lookaside_java-1.8.0-openjdk   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * Deregisters a server object from the runtime, allowing the object to become
 * available for garbage collection.
 * @param obj the object to unexport.
 * @exception NoSuchObjectException if the remote object is not
 * currently exported.
 */
public void unexportObject(Remote obj)
    throws NoSuchObjectException {

    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    if (StubAdapter.isStub(obj) ||
        obj instanceof java.rmi.server.RemoteStub) {
        throw new NoSuchObjectException(
            "Can only unexport a server object.");
    }

    Tie theTie = Util.getTie(obj);
    if (theTie != null) {
        Util.unexportObject(obj);
    } else {
        if (Utility.loadTie(obj) == null) {
            UnicastRemoteObject.unexportObject(obj,true);
        } else {
            throw new NoSuchObjectException("Object not exported.");
        }
    }
}
 
Example 15
Project: lookaside_java-1.8.0-openjdk   File: Util.java   View source code 6 votes vote down vote up
public void unregisterTargetsForORB(org.omg.CORBA.ORB orb)
{
    for (Enumeration e = exportedServants.keys(); e.hasMoreElements(); )
    {
        java.lang.Object key = e.nextElement();
        Remote target = (Remote)(key instanceof Tie ? ((Tie)key).getTarget() : key);

        // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set.
        // We can ignore this because it means the tie is not connected to an ORB.
        try {
            if (orb == getTie(target).orb()) {
                try {
                    unexportObject(target);
                } catch( java.rmi.NoSuchObjectException ex ) {
                    // We neglect this exception if at all if it is
                    // raised. It is not harmful.
                }
            }
        } catch (BAD_OPERATION bad) {
            /* Ignore */
        }
    }
}
 
Example 16
Project: lookaside_java-1.8.0-openjdk   File: Util.java   View source code 6 votes vote down vote up
/**
 * Registers a target for a tie. Adds the tie to an internal table and calls
 * {@link Tie#setTarget} on the tie object.
 * @param tie the tie to register.
 * @param target the target for the tie.
 */
public void registerTarget(javax.rmi.CORBA.Tie tie, java.rmi.Remote target)
{
    synchronized (exportedServants) {
        // Do we already have this target registered?
        if (lookupTie(target) == null) {
            // No, so register it and set the target...
            exportedServants.put(target,tie);
            tie.setTarget(target);

            // Do we need to instantiate our keep-alive thread?
            if (keepAlive == null) {
                // Yes. Instantiate our keep-alive thread and start
                // it up...
                keepAlive = (KeepAlive)AccessController.doPrivileged(new PrivilegedAction() {
                    public java.lang.Object run() {
                        return new KeepAlive();
                    }
                });
                keepAlive.start();
            }
        }
    }
}
 
Example 17
Project: jdk8u_corba   File: StubAdapter.java   View source code 6 votes vote down vote up
/** Given any Tie, return the corresponding object refernce, activating
 * the Servant if necessary.
 */
public static org.omg.CORBA.Object activateTie( Tie tie )
{
    /** Any implementation of Tie should be either a Servant or an ObjectImpl,
     * depending on which style of code generation is used.  rmic -iiop by
     * default results in an ObjectImpl-based Tie, while rmic -iiop -poa
     * results in a Servant-based Tie.  Dynamic RMI-IIOP also uses Servant-based
     * Ties (see impl.presentation.rmi.ReflectiveTie).
     */
    if (tie instanceof ObjectImpl) {
        return tie.thisObject() ;
    } else if (tie instanceof Servant) {
        Servant servant = (Servant)tie ;
        return activateServant( servant ) ;
    } else {
        throw wrapper.badActivateTieCall() ;
    }
}
 
Example 18
Project: jdk8u_corba   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * Deregisters a server object from the runtime, allowing the object to become
 * available for garbage collection.
 * @param obj the object to unexport.
 * @exception NoSuchObjectException if the remote object is not
 * currently exported.
 */
public void unexportObject(Remote obj)
    throws NoSuchObjectException {

    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    if (StubAdapter.isStub(obj) ||
        obj instanceof java.rmi.server.RemoteStub) {
        throw new NoSuchObjectException(
            "Can only unexport a server object.");
    }

    Tie theTie = Util.getTie(obj);
    if (theTie != null) {
        Util.unexportObject(obj);
    } else {
        if (Utility.loadTie(obj) == null) {
            UnicastRemoteObject.unexportObject(obj,true);
        } else {
            throw new NoSuchObjectException("Object not exported.");
        }
    }
}
 
Example 19
Project: jdk8u_corba   File: Util.java   View source code 6 votes vote down vote up
public void unregisterTargetsForORB(org.omg.CORBA.ORB orb)
{
    for (Enumeration e = exportedServants.keys(); e.hasMoreElements(); )
    {
        java.lang.Object key = e.nextElement();
        Remote target = (Remote)(key instanceof Tie ? ((Tie)key).getTarget() : key);

        // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set.
        // We can ignore this because it means the tie is not connected to an ORB.
        try {
            if (orb == getTie(target).orb()) {
                try {
                    unexportObject(target);
                } catch( java.rmi.NoSuchObjectException ex ) {
                    // We neglect this exception if at all if it is
                    // raised. It is not harmful.
                }
            }
        } catch (BAD_OPERATION bad) {
            /* Ignore */
        }
    }
}
 
Example 20
Project: jdk8u_corba   File: Util.java   View source code 6 votes vote down vote up
/**
 * Registers a target for a tie. Adds the tie to an internal table and calls
 * {@link Tie#setTarget} on the tie object.
 * @param tie the tie to register.
 * @param target the target for the tie.
 */
public void registerTarget(javax.rmi.CORBA.Tie tie, java.rmi.Remote target)
{
    synchronized (exportedServants) {
        // Do we already have this target registered?
        if (lookupTie(target) == null) {
            // No, so register it and set the target...
            exportedServants.put(target,tie);
            tie.setTarget(target);

            // Do we need to instantiate our keep-alive thread?
            if (keepAlive == null) {
                // Yes. Instantiate our keep-alive thread and start
                // it up...
                keepAlive = (KeepAlive)AccessController.doPrivileged(new PrivilegedAction() {
                    public java.lang.Object run() {
                        return new KeepAlive();
                    }
                });
                keepAlive.start();
            }
        }
    }
}
 
Example 21
Project: javify   File: UtilDelegateImpl.java   View source code 6 votes vote down vote up
/**
 * Register the Tie-target pair. As the Tie is a Servant, it can potentially
 * be connected to several objects and hence may be registered with several
 * targets.
 */
public void registerTarget(Tie tie, Remote target)
{
  synchronized (m_Ties)
    {
      synchronized (m_Targets)
        {
          TieTargetRecord r = (TieTargetRecord) m_Ties.get(tie);
          if (r == null)
            {
              // First registration for this Tie.
              r = new TieTargetRecord(tie);
              m_Ties.put(tie, r);
            }
          if (target != null)
            {
              r.add(target);
              m_Targets.put(target, r);
            }
        }
    }
}
 
Example 22
Project: jvm-stm   File: UtilDelegateImpl.java   View source code 6 votes vote down vote up
/**
 * Register the Tie-target pair. As the Tie is a Servant, it can potentially
 * be connected to several objects and hence may be registered with several
 * targets.
 */
public void registerTarget(Tie tie, Remote target)
{
  synchronized (m_Ties)
    {
      synchronized (m_Targets)
        {
          TieTargetRecord r = (TieTargetRecord) m_Ties.get(tie);
          if (r == null)
            {
              // First registration for this Tie.
              r = new TieTargetRecord(tie);
              m_Ties.put(tie, r);
            }
          if (target != null)
            {
              r.add(target);
              m_Targets.put(target, r);
            }
        }
    }
}
 
Example 23
Project: infobip-open-jdk-8   File: StubAdapter.java   View source code 6 votes vote down vote up
/** Given any Tie, return the corresponding object refernce, activating
 * the Servant if necessary.
 */
public static org.omg.CORBA.Object activateTie( Tie tie )
{
    /** Any implementation of Tie should be either a Servant or an ObjectImpl,
     * depending on which style of code generation is used.  rmic -iiop by
     * default results in an ObjectImpl-based Tie, while rmic -iiop -poa
     * results in a Servant-based Tie.  Dynamic RMI-IIOP also uses Servant-based
     * Ties (see impl.presentation.rmi.ReflectiveTie).
     */
    if (tie instanceof ObjectImpl) {
        return tie.thisObject() ;
    } else if (tie instanceof Servant) {
        Servant servant = (Servant)tie ;
        return activateServant( servant ) ;
    } else {
        throw wrapper.badActivateTieCall() ;
    }
}
 
Example 24
Project: infobip-open-jdk-8   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * Deregisters a server object from the runtime, allowing the object to become
 * available for garbage collection.
 * @param obj the object to unexport.
 * @exception NoSuchObjectException if the remote object is not
 * currently exported.
 */
public void unexportObject(Remote obj)
    throws NoSuchObjectException {

    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    if (StubAdapter.isStub(obj) ||
        obj instanceof java.rmi.server.RemoteStub) {
        throw new NoSuchObjectException(
            "Can only unexport a server object.");
    }

    Tie theTie = Util.getTie(obj);
    if (theTie != null) {
        Util.unexportObject(obj);
    } else {
        if (Utility.loadTie(obj) == null) {
            UnicastRemoteObject.unexportObject(obj,true);
        } else {
            throw new NoSuchObjectException("Object not exported.");
        }
    }
}
 
Example 25
Project: infobip-open-jdk-8   File: Util.java   View source code 6 votes vote down vote up
public void unregisterTargetsForORB(org.omg.CORBA.ORB orb)
{
    for (Enumeration e = exportedServants.keys(); e.hasMoreElements(); )
    {
        java.lang.Object key = e.nextElement();
        Remote target = (Remote)(key instanceof Tie ? ((Tie)key).getTarget() : key);

        // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set.
        // We can ignore this because it means the tie is not connected to an ORB.
        try {
            if (orb == getTie(target).orb()) {
                try {
                    unexportObject(target);
                } catch( java.rmi.NoSuchObjectException ex ) {
                    // We neglect this exception if at all if it is
                    // raised. It is not harmful.
                }
            }
        } catch (BAD_OPERATION bad) {
            /* Ignore */
        }
    }
}
 
Example 26
Project: infobip-open-jdk-8   File: Util.java   View source code 6 votes vote down vote up
/**
 * Registers a target for a tie. Adds the tie to an internal table and calls
 * {@link Tie#setTarget} on the tie object.
 * @param tie the tie to register.
 * @param target the target for the tie.
 */
public void registerTarget(javax.rmi.CORBA.Tie tie, java.rmi.Remote target)
{
    synchronized (exportedServants) {
        // Do we already have this target registered?
        if (lookupTie(target) == null) {
            // No, so register it and set the target...
            exportedServants.put(target,tie);
            tie.setTarget(target);

            // Do we need to instantiate our keep-alive thread?
            if (keepAlive == null) {
                // Yes. Instantiate our keep-alive thread and start
                // it up...
                keepAlive = (KeepAlive)AccessController.doPrivileged(new PrivilegedAction() {
                    public java.lang.Object run() {
                        return new KeepAlive();
                    }
                });
                keepAlive.start();
            }
        }
    }
}
 
Example 27
Project: openjdk-source-code-learn   File: StubAdapter.java   View source code 6 votes vote down vote up
/** Given any Tie, return the corresponding object refernce, activating
 * the Servant if necessary.
 */
public static org.omg.CORBA.Object activateTie( Tie tie )
{
    /** Any implementation of Tie should be either a Servant or an ObjectImpl,
     * depending on which style of code generation is used.  rmic -iiop by
     * default results in an ObjectImpl-based Tie, while rmic -iiop -poa
     * results in a Servant-based Tie.  Dynamic RMI-IIOP also uses Servant-based
     * Ties (see impl.presentation.rmi.ReflectiveTie).
     */
    if (tie instanceof ObjectImpl) {
        return tie.thisObject() ;
    } else if (tie instanceof Servant) {
        Servant servant = (Servant)tie ;
        return activateServant( servant ) ;
    } else {
        throw wrapper.badActivateTieCall() ;
    }
}
 
Example 28
Project: openjdk-source-code-learn   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * Deregisters a server object from the runtime, allowing the object to become
 * available for garbage collection.
 * @param obj the object to unexport.
 * @exception NoSuchObjectException if the remote object is not
 * currently exported.
 */
public void unexportObject(Remote obj)
    throws NoSuchObjectException {

    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    if (StubAdapter.isStub(obj) ||
        obj instanceof java.rmi.server.RemoteStub) {
        throw new NoSuchObjectException(
            "Can only unexport a server object.");
    }

    Tie theTie = Util.getTie(obj);
    if (theTie != null) {
        Util.unexportObject(obj);
    } else {
        if (Utility.loadTie(obj) == null) {
            UnicastRemoteObject.unexportObject(obj,true);
        } else {
            throw new NoSuchObjectException("Object not exported.");
        }
    }
}
 
Example 29
Project: openjdk-source-code-learn   File: Util.java   View source code 6 votes vote down vote up
public void unregisterTargetsForORB(org.omg.CORBA.ORB orb)
{
    for (Enumeration e = exportedServants.keys(); e.hasMoreElements(); )
    {
        java.lang.Object key = e.nextElement();
        Remote target = (Remote)(key instanceof Tie ? ((Tie)key).getTarget() : key);

        // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set.
        // We can ignore this because it means the tie is not connected to an ORB.
        try {
            if (orb == getTie(target).orb()) {
                try {
                    unexportObject(target);
                } catch( java.rmi.NoSuchObjectException ex ) {
                    // We neglect this exception if at all if it is
                    // raised. It is not harmful.
                }
            }
        } catch (BAD_OPERATION bad) {
            /* Ignore */
        }
    }
}
 
Example 30
Project: openjdk-source-code-learn   File: Util.java   View source code 6 votes vote down vote up
/**
 * Registers a target for a tie. Adds the tie to an internal table and calls
 * {@link Tie#setTarget} on the tie object.
 * @param tie the tie to register.
 * @param target the target for the tie.
 */
public void registerTarget(javax.rmi.CORBA.Tie tie, java.rmi.Remote target)
{
    synchronized (exportedServants) {
        // Do we already have this target registered?
        if (lookupTie(target) == null) {
            // No, so register it and set the target...
            exportedServants.put(target,tie);
            tie.setTarget(target);

            // Do we need to instantiate our keep-alive thread?
            if (keepAlive == null) {
                // Yes. Instantiate our keep-alive thread and start
                // it up...
                keepAlive = (KeepAlive)AccessController.doPrivileged(new PrivilegedAction() {
                    public java.lang.Object run() {
                        return new KeepAlive();
                    }
                });
                keepAlive.start();
            }
        }
    }
}
 
Example 31
Project: OLD-OpenJDK8   File: StubAdapter.java   View source code 6 votes vote down vote up
/** Given any Tie, return the corresponding object refernce, activating
 * the Servant if necessary.
 */
public static org.omg.CORBA.Object activateTie( Tie tie )
{
    /** Any implementation of Tie should be either a Servant or an ObjectImpl,
     * depending on which style of code generation is used.  rmic -iiop by
     * default results in an ObjectImpl-based Tie, while rmic -iiop -poa
     * results in a Servant-based Tie.  Dynamic RMI-IIOP also uses Servant-based
     * Ties (see impl.presentation.rmi.ReflectiveTie).
     */
    if (tie instanceof ObjectImpl) {
        return tie.thisObject() ;
    } else if (tie instanceof Servant) {
        Servant servant = (Servant)tie ;
        return activateServant( servant ) ;
    } else {
        throw wrapper.badActivateTieCall() ;
    }
}
 
Example 32
Project: OLD-OpenJDK8   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * Deregisters a server object from the runtime, allowing the object to become
 * available for garbage collection.
 * @param obj the object to unexport.
 * @exception NoSuchObjectException if the remote object is not
 * currently exported.
 */
public void unexportObject(Remote obj)
    throws NoSuchObjectException {

    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    if (StubAdapter.isStub(obj) ||
        obj instanceof java.rmi.server.RemoteStub) {
        throw new NoSuchObjectException(
            "Can only unexport a server object.");
    }

    Tie theTie = Util.getTie(obj);
    if (theTie != null) {
        Util.unexportObject(obj);
    } else {
        if (Utility.loadTie(obj) == null) {
            UnicastRemoteObject.unexportObject(obj,true);
        } else {
            throw new NoSuchObjectException("Object not exported.");
        }
    }
}
 
Example 33
Project: OLD-OpenJDK8   File: Util.java   View source code 6 votes vote down vote up
public void unregisterTargetsForORB(org.omg.CORBA.ORB orb)
{
    for (Enumeration e = exportedServants.keys(); e.hasMoreElements(); )
    {
        java.lang.Object key = e.nextElement();
        Remote target = (Remote)(key instanceof Tie ? ((Tie)key).getTarget() : key);

        // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set.
        // We can ignore this because it means the tie is not connected to an ORB.
        try {
            if (orb == getTie(target).orb()) {
                try {
                    unexportObject(target);
                } catch( java.rmi.NoSuchObjectException ex ) {
                    // We neglect this exception if at all if it is
                    // raised. It is not harmful.
                }
            }
        } catch (BAD_OPERATION bad) {
            /* Ignore */
        }
    }
}
 
Example 34
Project: OLD-OpenJDK8   File: Util.java   View source code 6 votes vote down vote up
/**
 * Registers a target for a tie. Adds the tie to an internal table and calls
 * {@link Tie#setTarget} on the tie object.
 * @param tie the tie to register.
 * @param target the target for the tie.
 */
public void registerTarget(javax.rmi.CORBA.Tie tie, java.rmi.Remote target)
{
    synchronized (exportedServants) {
        // Do we already have this target registered?
        if (lookupTie(target) == null) {
            // No, so register it and set the target...
            exportedServants.put(target,tie);
            tie.setTarget(target);

            // Do we need to instantiate our keep-alive thread?
            if (keepAlive == null) {
                // Yes. Instantiate our keep-alive thread and start
                // it up...
                keepAlive = (KeepAlive)AccessController.doPrivileged(new PrivilegedAction() {
                    public java.lang.Object run() {
                        return new KeepAlive();
                    }
                });
                keepAlive.start();
            }
        }
    }
}
 
Example 35
Project: JamVM-PH   File: UtilDelegateImpl.java   View source code 6 votes vote down vote up
/**
 * Register the Tie-target pair. As the Tie is a Servant, it can potentially
 * be connected to several objects and hence may be registered with several
 * targets.
 */
public void registerTarget(Tie tie, Remote target)
{
  synchronized (m_Ties)
    {
      synchronized (m_Targets)
        {
          TieTargetRecord r = (TieTargetRecord) m_Ties.get(tie);
          if (r == null)
            {
              // First registration for this Tie.
              r = new TieTargetRecord(tie);
              m_Ties.put(tie, r);
            }
          if (target != null)
            {
              r.add(target);
              m_Targets.put(target, r);
            }
        }
    }
}
 
Example 36
Project: openjdk-orb   File: StubAdapter.java   View source code 6 votes vote down vote up
/** Given any Tie, return the corresponding object refernce, activating
 * the Servant if necessary.
 */
public static org.omg.CORBA.Object activateTie( Tie tie )
{
    /** Any implementation of Tie should be either a Servant or an ObjectImpl,
     * depending on which style of code generation is used.  rmic -iiop by
     * default results in an ObjectImpl-based Tie, while rmic -iiop -poa
     * results in a Servant-based Tie.  Dynamic RMI-IIOP also uses Servant-based
     * Ties (see impl.presentation.rmi.ReflectiveTie).
     */
    if (tie instanceof ObjectImpl) {
        return tie.thisObject() ;
    } else if (tie instanceof Servant) {
        Servant servant = (Servant)tie ;
        return activateServant( servant ) ;
    } else {
        throw wrapper.badActivateTieCall() ;
    }
}
 
Example 37
Project: openjdk-orb   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * Deregisters a server object from the runtime, allowing the object to become
 * available for garbage collection.
 * @param obj the object to unexport.
 * @exception NoSuchObjectException if the remote object is not
 * currently exported.
 */
public void unexportObject(Remote obj)
    throws NoSuchObjectException {

    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    if (StubAdapter.isStub(obj) ||
        obj instanceof java.rmi.server.RemoteStub) {
        throw new NoSuchObjectException(
            "Can only unexport a server object.");
    }

    Tie theTie = Util.getTie(obj);
    if (theTie != null) {
        Util.unexportObject(obj);
    } else {
        if (Utility.loadTie(obj) == null) {
            UnicastRemoteObject.unexportObject(obj,true);
        } else {
            throw new NoSuchObjectException("Object not exported.");
        }
    }
}
 
Example 38
Project: openjdk-orb   File: Util.java   View source code 6 votes vote down vote up
public void unregisterTargetsForORB(org.omg.CORBA.ORB orb)
{
    for (Enumeration e = exportedServants.keys(); e.hasMoreElements(); )
    {
        java.lang.Object key = e.nextElement();
        Remote target = (Remote)(key instanceof Tie ? ((Tie)key).getTarget() : key);

        // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set.
        // We can ignore this because it means the tie is not connected to an ORB.
        try {
            if (orb == getTie(target).orb()) {
                try {
                    unexportObject(target);
                } catch( java.rmi.NoSuchObjectException ex ) {
                    // We neglect this exception if at all if it is
                    // raised. It is not harmful.
                }
            }
        } catch (BAD_OPERATION bad) {
            /* Ignore */
        }
    }
}
 
Example 39
Project: openjdk-orb   File: Util.java   View source code 6 votes vote down vote up
/**
 * Registers a target for a tie. Adds the tie to an internal table and calls
 * {@link Tie#setTarget} on the tie object.
 * @param tie the tie to register.
 * @param target the target for the tie.
 */
public void registerTarget(javax.rmi.CORBA.Tie tie, java.rmi.Remote target)
{
    synchronized (exportedServants) {
        // Do we already have this target registered?
        if (lookupTie(target) == null) {
            // No, so register it and set the target...
            exportedServants.put(target,tie);
            tie.setTarget(target);

            // Do we need to instantiate our keep-alive thread?
            if (keepAlive == null) {
                // Yes. Instantiate our keep-alive thread and start
                // it up...
                keepAlive = (KeepAlive)AccessController.doPrivileged(new PrivilegedAction() {
                    public java.lang.Object run() {
                        return new KeepAlive();
                    }
                });
                keepAlive.start();
            }
        }
    }
}
 
Example 40
Project: classpath   File: UtilDelegateImpl.java   View source code 6 votes vote down vote up
/**
 * Register the Tie-target pair. As the Tie is a Servant, it can potentially
 * be connected to several objects and hence may be registered with several
 * targets.
 */
public void registerTarget(Tie tie, Remote target)
{
  synchronized (m_Ties)
    {
      synchronized (m_Targets)
        {
          TieTargetRecord r = (TieTargetRecord) m_Ties.get(tie);
          if (r == null)
            {
              // First registration for this Tie.
              r = new TieTargetRecord(tie);
              m_Ties.put(tie, r);
            }
          if (target != null)
            {
              r.add(target);
              m_Targets.put(target, r);
            }
        }
    }
}