public interface ToolLifeCycleExecContextPlugin
ExecContextPlugin implementations that need to be
informed of tool life cycle.
This allows an ExecContextPlugin to explicitly bind itself to an
ExecContext information scope.
The ExecContext implementation having an ExecContextPlugin whose implementation implements this ToolLifeCycleExecContextPlugin is expected to behave in the following manner:
isTransient() returns true, it must create and release the
ExecContextPlugin for each tool execution. This implies that the
ExecContextPlugin is bound to tool scope;isTransient() returns false, it can keep the ExecContextPlugin
instance alive in between tool execution. This implies that the
ExecContextPlugin is bound to workspace scope;startTool() during tool initialization;endTool() during tool termination.If an ExecContextPlugin implementation does not implement that interface and the ExecContext implementation does handle it, it must treat the ExecContextPlugin as if isTransient returns false, implying workspace binding.
The two above paragraphs may seem incoherent (assume isTransient returns true in one case and itTransient returns false in the other). But they are not. The idea is that if an ExecContextPlugin does not implement that interface, it implicitly "agrees" to be bound to workspace scope, the default. But if the ExecContextPlugin does implement this interface and isTransient returns true, it effectively does not support workspace scope, whereas all ExecContextPlugin's implicitly support tool scope, even if isTransient returns false.
If isTransient returns false and ExecContextPlugin's instances are reused across tool executions, it also implies that two tools could execute simultaneously on the same ExecContext (on different threads), and thus with the same ExecContextPlugin instance. It is up to the ExecContextPlugin to handle this situation, or prevent it from happening. DefaultWorkspacePluginFactory from dragom-core prevents this from happening by locking the workspace directory, and thus the ExecContext to which it is associated, using a marker lock file.
| Modifier and Type | Method and Description |
|---|---|
void |
endTool()
Informs the
ExecContextPlugin that a tool is terminated with the
ExecContext holding it. |
boolean |
isTransient() |
void |
startTool()
Informs the
ExecContextPlugin that a tool is started with the
ExecContext holding it. |
boolean isTransient()
ExecContextPlugin must not be reused across
tool executions, implying tool binding. If false, the ExecContextPlugin may
be reused across tool executions, implying workspace binding.void startTool()
ExecContextPlugin that a tool is started with the
ExecContext holding it.
This gives an opportunity to the ExecContextPlugin to perform per-tool initialization.
void endTool()
ExecContextPlugin that a tool is terminated with the
ExecContext holding it.
This gives an opportunity to the ExecContextPlugin to perform per-tool cleanup.
Copyright © 2015–2017 AZYVA INC.. All rights reserved.