Package com._1c.g5.v8.dt.pm
Interface ICloseableInstance<T>
-
- Type Parameters:
T- the type of service
- All Superinterfaces:
AutoCloseable
public interface ICloseableInstance<T> extends AutoCloseable
Provides a wrapper of instance created by
IProcessManager.getInstance(String, Class)method which implementsAutoCloseable. An instance of this interface should be obtained byIProcessManager.getCloseableInstance(String, Class)method. Theclose()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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Disposes the wrapped instance from process manager with that this instance was created.TgetInstance()Returns a wrapped instance of T service.
-
-
-
Method Detail
-
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
-
-