
IceInternal.ObjectFactoryManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ice Show documentation
Show all versions of ice Show documentation
Ice is a comprehensive RPC framework that helps you build distributed applications with minimal effort using familiar object-oriented idioms
// **********************************************************************
//
// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
package IceInternal;
public final class ObjectFactoryManager
{
public synchronized void
add(Ice.ObjectFactory factory, String id)
{
Object o = _factoryMap.get(id);
if(o != null)
{
Ice.AlreadyRegisteredException ex = new Ice.AlreadyRegisteredException();
ex.id = id;
ex.kindOfObject = "object factory";
throw ex;
}
_factoryMap.put(id, factory);
}
public void
remove(String id)
{
Ice.ObjectFactory factory = null;
synchronized(this)
{
factory = _factoryMap.get(id);
if(factory == null)
{
Ice.NotRegisteredException ex = new Ice.NotRegisteredException();
ex.id = id;
ex.kindOfObject = "object factory";
throw ex;
}
_factoryMap.remove(id);
}
factory.destroy();
}
public synchronized Ice.ObjectFactory
find(String id)
{
return _factoryMap.get(id);
}
//
// Only for use by Instance
//
ObjectFactoryManager()
{
}
void
destroy()
{
java.util.Map oldMap = null;
synchronized(this)
{
oldMap = _factoryMap;
_factoryMap = new java.util.HashMap();
}
for(Ice.ObjectFactory factory : oldMap.values())
{
factory.destroy();
}
}
private java.util.Map _factoryMap = new java.util.HashMap();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy