@SuppressWarnings("unused") private void writeObject(ObjectOutputStream oos) throws IOException { if ( log.isTraceEnabled() ) { log.trace( "Serializing " + getClass().getSimpleName() + " [" ); } if ( !jdbcCoordinator.isReadyForSerialization() ) { // throw a more specific (helpful) exception message when this happens from Session, // as opposed to more generic exception from jdbcCoordinator#serialize call later throw new IllegalStateException( "Cannot serialize " + getClass().getSimpleName() + " [" + getSessionIdentifier() + "] while connected" ); } if ( isTransactionCoordinatorShared ) { throw new IllegalStateException( "Cannot serialize " + getClass().getSimpleName() + " [" + getSessionIdentifier() + "] as it has a shared TransactionCoordinator" ); } // todo : (5.2) come back and review serialization plan... // this was done quickly during initial HEM consolidation into CORE and is likely not perfect :) // // be sure to review state fields in terms of transient modifiers // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Step 1 :: write non-transient state... oos.defaultWriteObject(); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Step 2 :: write transient state... // -- see concurrent access discussion factory.serialize( oos ); oos.writeObject( jdbcSessionContext.getStatementInspector() ); jdbcCoordinator.serialize( oos ); }
@SuppressWarnings("unused") private void writeObject(ObjectOutputStream oos) throws IOException { if ( log.isTraceEnabled() ) { log.trace( "Serializing " + getClass().getSimpleName() + " [" ); } if ( !jdbcCoordinator.isReadyForSerialization() ) { // throw a more specific (helpful) exception message when this happens from Session, // as opposed to more generic exception from jdbcCoordinator#serialize call later throw new IllegalStateException( "Cannot serialize " + getClass().getSimpleName() + " [" + getSessionIdentifier() + "] while connected" ); } if ( isTransactionCoordinatorShared ) { throw new IllegalStateException( "Cannot serialize " + getClass().getSimpleName() + " [" + getSessionIdentifier() + "] as it has a shared TransactionCoordinator" ); } // todo : (5.2) come back and review serialization plan... // this was done quickly during initial HEM consolidation into CORE and is likely not perfect :) // // be sure to review state fields in terms of transient modifiers // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Step 1 :: write non-transient state... oos.defaultWriteObject(); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Step 2 :: write transient state... // -- see concurrent access discussion factory.serialize( oos ); oos.writeObject( jdbcSessionContext.getStatementInspector() ); jdbcCoordinator.serialize( oos ); }
/** * Used by JDK serialization... * * @param oos The output stream to which we are being written... * @throws IOException Indicates a general IO stream exception */ private void writeObject(ObjectOutputStream oos) throws IOException { if ( ! transactionCoordinator.getJdbcCoordinator().getLogicalConnection().isReadyForSerialization() ) { throw new IllegalStateException( "Cannot serialize a session while connected" ); } LOG.trace( "Serializing session" ); oos.defaultWriteObject(); oos.writeObject( connectionReleaseMode.toString() ); oos.writeBoolean( autoClear ); oos.writeBoolean( autoJoinTransactions ); oos.writeObject( flushMode.toString() ); oos.writeObject( cacheMode.name() ); oos.writeBoolean( flushBeforeCompletionEnabled ); oos.writeBoolean( autoCloseSessionEnabled ); // we need to writeObject() on this since interceptor is user defined oos.writeObject( interceptor ); factory.serialize( oos ); transactionCoordinator.serialize( oos ); persistenceContext.serialize( oos ); actionQueue.serialize( oos ); // todo : look at optimizing these... oos.writeObject( loadQueryInfluencers ); }
/** * Used by JDK serialization... * * @param oos The output stream to which we are being written... * @throws IOException Indicates a general IO stream exception */ private void writeObject(ObjectOutputStream oos) throws IOException { if ( ! transactionCoordinator.getJdbcCoordinator().getLogicalConnection().isReadyForSerialization() ) { throw new IllegalStateException( "Cannot serialize a session while connected" ); } LOG.trace( "Serializing session" ); oos.defaultWriteObject(); oos.writeObject( connectionReleaseMode.toString() ); oos.writeBoolean( autoClear ); oos.writeBoolean( autoJoinTransactions ); oos.writeObject( flushMode.toString() ); oos.writeObject( cacheMode.name() ); oos.writeBoolean( flushBeforeCompletionEnabled ); oos.writeBoolean( autoCloseSessionEnabled ); // we need to writeObject() on this since interceptor is user defined oos.writeObject( interceptor ); factory.serialize( oos ); transactionCoordinator.serialize( oos ); persistenceContext.serialize( oos ); actionQueue.serialize( oos ); // todo : look at optimizing these... oos.writeObject( loadQueryInfluencers ); }