Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7082961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:07:11+00:00 2026-05-28T07:07:11+00:00

I have the following problem. I can set the transaction state to be either

  • 0

I have the following problem. I can set the transaction state to be either “start, end or ongoing”. I set this, then serialise my Transaction object over to the server, who retrieves it. Works like a charm the first time (when the transaction is in start mode), but then when I resend the object, this time in “ongoing” mode, the server continues to see it in “start” mode. I’ve tested the code at the line before the serialization, and the line after the deserialization, and this is definitely where the problem is. Any help would be very much appreciated. The relevant code snippets are as follows:

serialization

        if ((query instanceof Transaction) && !(trx.getTransactionState()==Consts.trx_start)) System.out.println("Not start");
        oos.writeObject(query);
        oos.flush();

deserialization

    while (true) {
                Object statement = null;

                try {

                    statement = ois.readObject();
                    if ((statement instanceof Transaction) && !(((Transaction) statement).getTransactionState()==Consts.trx_start)) System.out.println("Not start 2");
                    handle_statement(statement, socket);
                } catch (IOException e) {

and the Transaction class:

    public class Transaction extends Statement{

/**
 * 
 */
private static final long serialVersionUID = -2284996855537430822L;
Statement statement_list;
int trx_state; 


/**
 * 
 */
public Transaction() {
    trx_state = Consts.trx_start;; 
}

/**
 * @param statement
 */
public void setStatement(Statement statement ) { 
    statement_list = statement; 
} 


public void setTransactionState(int state) {
        trx_state = state; 
}

public int getTransactionState() {
    return trx_state; 
}
/**
 * @return
 */
public Statement getStatement() {
    return statement_list;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:07:11+00:00Added an answer on May 28, 2026 at 7:07 am

    The ObjectOutputStream caches instances that it sends over the wire (not necessarily the best design tbh). But in any case, you need to reset the output streams in-between calls if you plan on using it to (re)send the same object instance.

    public void reset() throws IOException

    Reset will disregard the state of any objects already
    written to the stream. The state is reset to be the
    same as a new ObjectOutputStream. The current point in the stream is
    marked as reset so the corresponding ObjectInputStream will be reset
    at the same point. Objects previously written to the stream will not
    be refered to as already being in the stream. They will be written to
    the stream again.

    Another SO thread discussing this very same issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following problem: I have an Activity where a user can start
I have the following problem. I have a set of elements that I can
it is the problem, i can't undertand anyway. i have the following simple script
I have the following problem: Let's consider we have #define SET callMe #define COLUMN(x)
I have the following problem: on the main page I can change language. New
I have the following problem. I have a data set that has the beginning
I have the following problem: I use taxonomys (tx) as tags. They can be
I have following problem: I have built a tabbar application with 4 tabs. I
I have following problem, Code: String a=Yeahh, I have no a idea what's happening
I have the following problem: I have an HTML textbox ( <input type=text> )

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.