Package com._1c.g5.v8.dt.pm
Interface ICloseableInstance<T>
- Type Parameters:
T- the type of service
- All Superinterfaces:
AutoCloseable
Provides a wrapper of instance created by IProcessManager.getInstance(String, Class) method
which implements AutoCloseable. An instance of this interface should be obtained
by IProcessManager.getCloseableInstance(String, Class) method.
The close() method disposes wrapped instance from process manager with that the instance was created.
An example of using:
try (ICloseableInstance<YourService> closeableInstance = processManager.getCloseableInstance(key, YourService.class))
{
YourService service = closeableInstance.getInstance();
// Do something with service
// ...
}
catch (IllegalStateException e){...}
catch (RemoteException e){...}
catch (InstantiationException e){...}
catch (IllegalAccessException e){...}
catch (URISyntaxException e){...}
catch (IOException e){...}
catch (InterruptedException e){...}
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Disposes the wrapped instance from process manager with that this instance was created.Returns a wrapped instance of T service.
-
Method Details
-
getInstance
T getInstance()Returns a wrapped instance of T service.
- Returns:
- a wrapped instance of T service
-
close
void close()Disposes the wrapped instance from process manager with that this instance was created.
- Specified by:
closein interfaceAutoCloseable
-