public interface ArmApplication extends ArmInterface
ArmTransaction
objects with the application instance.
It has the following attributes, all of which are immutable:
null
.
null
.
A non-null
value should not contain trailing blank
characters or consist of only blank characters.
null
.
A non-null
value should not contain trailing blank
characters or consist of only blank characters.
getDefinition().getIdentityProperties().getContextName()
.
The values are position-sensitive - they match the position in the
referenced context name array. The context property name at the specified
array index must have been set to a non-null
value when the
ArmApplicationDefinition
object was created. If the name is
null
or a zero-length string, both the name and value are
ignored. If the value is null
or a zero-length string,
the meaning is that there is no value for this instance. Names should not
contain trailing blank characters or consist of only blank characters.
Note that both ArmApplication
and
ArmTransaction
have context values that may be
unique for each application and transaction instance, respectively.
However, the mechanisms for setting the context values are different.
In ArmApplication
, they are set in the factory method and
are immutable afterwards. In ArmTransaction
, they are set at
any time and processed each time a start()
executes.
The reason for the difference is that ArmApplication
objects
are not reused. One object is created per application instance.
If another instance starts, a new ArmApplication
is
created. This is a reasonable design pattern because applications
are long-lived. In most cases, once an application starts, it continues
to execute for a long time, so the cost of creating the
ArmApplication
object and then garbage collecting it is not
significant.
Transactions, on the other hand, are often very short-lived, with
response times that are often measured in milliseconds. Creating a
new ArmTransaction
object for each transaction instance,
and then garbage collecting it afterwards, would result in unacceptable
and unnecessary overhead. Instead, an ArmTransaction
object
is created and then reused over and over. Each executing transaction
is represented by the paired start()
/stop()
methods. For this reason, context values are set using setter methods.
end()
indicates that the application instance has
halted. After end()
executes, the application instance
may not call any other method of the ArmApplication
object, it may not use any reference to the ArmApplication
object, nor may it call any method of any object created using a
reference to the ArmApplication
object (e.g., creating
an instance of ArmTransaction
using the
newArmTransaction()
method of
ArmTransactionFactory
). Any transactions that are currently
in-process [start()
executed but stop()
not
executed] will be discarded by implicitly executing the
ArmTransaction reset()
method. The ARM implementation
should protect itself against a poorly behaved application that does
not respect the specification.
Objects implementing this interface are created using
ArmTransactionFactory.newArmApplication(org.opengroup.arm40.transaction.ArmApplicationDefinition, java.lang.String, java.lang.String, java.lang.String[])
.Modifier and Type | Method and Description |
---|---|
int |
end()
indicates that the application instance has halted.
|
java.lang.String |
getContextValue(int index)
retrieves a context property value.
|
ArmApplicationDefinition |
getDefinition() |
java.lang.String |
getGroup() |
java.lang.String |
getInstance() |
getErrorCode, getErrorMessage, setErrorCode
int end()
ArmInterface
).java.lang.String getContextValue(int index)
index
- the index into the context properties array.null
. See comments in the interface description above.ArmApplicationDefinition getDefinition()
java.lang.String getGroup()
null
. See comments in the interface description above.java.lang.String getInstance()
null
. See comments in the interface description above.