이 콘텐츠는 선택한 언어로 제공되지 않습니다.

10.2. State management


10.2.1. Object States

JBoss Transaction Service remembers the state of an object for the purposes of recovery and persistence. In the case of recovery, the state represents some past state of the object. When persistence is involved, the state represents the final state of an object at application termination. Since recovery and persistence include common functionality, they are both implemented using the Input/OutputObjectState and Input/OutputBuffer classes.
The InputBuffer class in Example 10.2, “InputBuffer” and the OutputBuffer classes in Example 10.1, “OutputBuffer Example” maintain an internal array into which instances of the standard Java types can be contiguously packed (unpacked) using the pack (unpack) operations. This buffer is automatically resized as required. The instances are all stored in the buffer in a standard form called network byte order, making them machine-independent.

Example 10.1. OutputBuffer Example

public class OutputBuffer
{
    public OutputBuffer ();

    public final synchronized boolean valid ();
    public synchronized byte[] buffer();
    public synchronized int length ();

    /* pack operations for standard Java types */

    public synchronized void packByte (byte b) throws IOException;
    public synchronized void packBytes (byte[] b) throws IOException;
    public synchronized void packBoolean (boolean b) throws IOException;
    public synchronized void packChar (char c) throws IOException;
    public synchronized void packShort (short s) throws IOException;
    public synchronized void packInt (int i) throws IOException;
    public synchronized void packLong (long l) throws IOException;
    public synchronized void packFloat (float f) throws IOException;
    public synchronized void packDouble (double d) throws IOException;
    public synchronized void packString (String s) throws IOException;
};
Copy to Clipboard Toggle word wrap

Example 10.2. InputBuffer

public class InputBuffer
{
    public InputBuffer ();

    public final synchronized boolean valid ();
    public synchronized byte[] buffer();
    public synchronized int length ();

    /* unpack operations for standard Java types */

    public synchronized byte unpackByte () throws IOException;
    public synchronized byte[] unpackBytes () throws IOException;
    public synchronized boolean unpackBoolean () throws IOException;
    public synchronized char unpackChar () throws IOException;
    public synchronized short unpackShort () throws IOException;
    public synchronized int unpackInt () throws IOException;
    public synchronized long unpackLong () throws IOException;
    public synchronized float unpackFloat () throws IOException;
    public synchronized double unpackDouble () throws IOException;
    public synchronized String unpackString () throws IOException;
};
Copy to Clipboard Toggle word wrap

Example 10.3. OutputObjectState

class OutputObjectState extends OutputBuffer
{
    public OutputObjectState (Uid newUid, String typeName);

    public boolean notempty ();
    public int size ();
    public Uidpublic class InputBuffer
    {
	public InputBuffer ();

	public final synchronized boolean valid ();
	public synchronized byte[] buffer();
	public synchronized int length ();

	/* unpack operations for standard Java types */

	public synchronized byte unpackByte () throws IOException;
	public synchronized byte[] unpackBytes () throws IOException;
	public synchronized boolean unpackBoolean () throws IOException;
	public synchronized char unpackChar () throws IOException;
	public synchronized short unpackShort () throws IOException;
	public synchronized int unpackInt () throws IOException;
	public synchronized long unpackLong () throws IOException;
	public synchronized float unpackFloat () throws IOException;
	public synchronized double unpackDouble () throws IOException;
	public synchronized String unpackString () throws IOException;
    };
Copy to Clipboard Toggle word wrap

Example 10.4. InputObjectState

class InputObjectState extends InputBuffer
{
    public InputObjectState (Uid newUid, String typeName, byte[] b);

    public boolean notempty ();
    public int size ();
    public Uid stateUid ();
    public String type ();
};
Copy to Clipboard Toggle word wrap
The Example 10.4, “InputObjectState” and Example 10.3, “OutputObjectState” classes provides all the functionality of the InputBuffer and OutputBuffer classes, through inheritance. They also add two additional instance variables that signify the Uid and type of the object for which the InputObjectState or OutputObjectState instance is a compressed image. These are used when accessing the object store during storage and retrieval of the object state.
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2026 Red Hat