Hi,
Creating a communicator is an expensive operation, and is not something I would recommend doing for every HTTP request.
Rather, your servlet should create the communicator once (e.g., in the servlet's init method) and use that same instance for every HTTP request. Furthermore, if all HTTP requests result in invocations on the same Ice object, then your servlet should also create the proxy in the init method.
For example:
Code:
public class MyServlet extends HttpServlet
{
public void init() throws ServletException
{
try
{
String[] args = {};
_communicator = Ice.Util.initialize(args);
Ice.ObjectPrx proxy = _communicator.stringToProxy("...");
_searcher = SearcherPrxHelper.checkedCast(proxy);
if(_searcher == null)
{
throw new UnavailableException("Invalid proxy");
}
}
catch(Exception ex)
{
UnavailableException e = new UnavailableException("Ice failure");
e.initCause(ex);
throw e;
}
}
public void destroy()
{
if(_communicator != null)
{
try
{
_communicator.destroy();
}
catch(Exception ex)
{
// Ignore
}
}
}
...
private Ice.Communicator _communicator;
private SearcherPrx _searcher;
}
We'll investigate whether the exception you saw is the result of a problem in Ice.
Take care,
- Mark