use of org.glassfish.api.naming.GlassfishNamingManager in project Payara by payara.
the class GlassFishORBHelper method getORB.
/**
* Get or create the default orb. This can be called for any process type. However,
* protocol manager and CosNaming initialization only take place for the Server.
*/
public ORB getORB() {
// and allow an invocation to the transport to complete.
if (orb == null) {
synchronized (this) {
if (orb == null) {
try {
final boolean isServer = processEnv.getProcessType().isServer();
Properties props = new Properties();
props.setProperty(GlassFishORBFactory.ENV_IS_SERVER_PROPERTY, Boolean.valueOf(isServer).toString());
// Create orb and make it visible. This will allow
// loopback calls to getORB() from
// portable interceptors activated as a side-effect of the
// remaining initialization. If it's a
// server, there's a small time window during which the
// ProtocolManager won't be available. Any callbacks that
// result from the protocol manager initialization itself
// cannot depend on having access to the protocol manager.
orb = getORBFactory().createORB(props);
if (isServer) {
if (protocolManager == null) {
ProtocolManager tempProtocolManager = protocolManagerProvider.get();
tempProtocolManager.initialize(orb);
// Move startup of naming to PEORBConfigurator so it runs
// before interceptors.
// tempProtocolManager.initializeNaming();
tempProtocolManager.initializePOAs();
// Now make protocol manager visible.
protocolManager = tempProtocolManager;
GlassfishNamingManager namingManager = glassfishNamingManagerProvider.get();
Remote remoteSerialProvider = namingManager.initializeRemoteNamingSupport(orb);
protocolManager.initializeRemoteNaming(remoteSerialProvider);
}
}
} catch (Exception e) {
orb = null;
protocolManager = null;
throw new RuntimeException("Orb initialization erorr", e);
}
}
}
}
return orb;
}
use of org.glassfish.api.naming.GlassfishNamingManager in project Payara by payara.
the class AppTest method testBind.
@Test
public void testBind() {
GlassfishNamingManager nm = null;
try {
InvocationManager im = new InvocationManagerImpl();
InitialContext ic = newInitialContext();
nm = new GlassfishNamingManagerImpl(ic);
nm.publishObject("foo", "Hello: foo", false);
System.out.println("**lookup() ==> " + ic.lookup("foo"));
assert (true);
} catch (Exception ex) {
ex.printStackTrace();
assert (false);
} finally {
try {
nm.unpublishObject("foo");
} catch (Exception ex) {
}
}
}
use of org.glassfish.api.naming.GlassfishNamingManager in project Payara by payara.
the class MEJBService method postConstruct.
public void postConstruct() {
GlassfishNamingManager gfNamingManager = gfNamingManagerProvider.get();
MEJBNamingObjectProxy mejbProxy = new MEJBNamingObjectProxy(habitat);
for (String next : MEJBNamingObjectProxy.getJndiNames()) {
try {
gfNamingManager.publishObject(next, mejbProxy, true);
} catch (Exception e) {
_logger.log(Level.WARNING, "Problem in publishing temp proxy for MEJB: " + e.getMessage(), e);
}
}
}
Aggregations