org.apache.jdo.impl.fostore
Class FOStoreConnector

java.lang.Object
  extended byorg.apache.jdo.impl.fostore.FOStoreConnector
All Implemented Interfaces:
org.apache.jdo.store.Connector

class FOStoreConnector
extends java.lang.Object
implements org.apache.jdo.store.Connector

FOStoreConnector represents a connection to the FOStoreDatabase.

Author:
Dave Bristor

Field Summary
private  boolean busy
          True if flush is in progress.
(package private)  FOStoreClientConnection connection
          Connection for interacting with store.
(package private) static org.apache.commons.logging.Log logger
          Logger
private  Message message
          Message in which this Connector buffers requests for the store.
private static org.apache.jdo.util.I18NHelper msg
          I18N support.
private  boolean okToReleaseConnection
          True if we can release this connection after flushing.
private  FOStorePMF pmf
          Datasource to which this Connector writes its Message.
private  boolean rollbackOnly
           
 
Constructor Summary
(package private) FOStoreConnector(FOStorePMF pmf)
           
 
Method Summary
private  void assertNotBusy(java.lang.String methodName)
           
private  void assertNotRollbackOnly()
           
 void beforeCompletion()
           
 void begin(boolean optimistic)
           
 void commit()
          Add a CommitRequest to the connector's message, and send it to the store.
 void flush()
          Get a connection, process the message by using that connection to interact with the database, read back the reply, release the connection.
(package private)  Message getMessage()
          Provides the Message which this this connector uses to send data to the store.
 boolean getRollbackOnly()
           
 void rollback()
          If rollbackOnly is set, then the store has already done a rollback, so we don't do one now (but neither do we throw an exception, as do other methds).
 void setRollbackOnly()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rollbackOnly

private boolean rollbackOnly
See Also:
Connector.setRollbackOnly()

msg

private static final org.apache.jdo.util.I18NHelper msg
I18N support.


logger

static final org.apache.commons.logging.Log logger
Logger


message

private final Message message
Message in which this Connector buffers requests for the store.


pmf

private final FOStorePMF pmf
Datasource to which this Connector writes its Message.


connection

FOStoreClientConnection connection
Connection for interacting with store.


okToReleaseConnection

private boolean okToReleaseConnection
True if we can release this connection after flushing. By default we can; affected by transactions beginning and ending and their types.


busy

private boolean busy
True if flush is in progress.

Constructor Detail

FOStoreConnector

FOStoreConnector(FOStorePMF pmf)
Method Detail

begin

public void begin(boolean optimistic)
Specified by:
begin in interface org.apache.jdo.store.Connector
See Also:
Connector.begin(boolean)

beforeCompletion

public void beforeCompletion()
Specified by:
beforeCompletion in interface org.apache.jdo.store.Connector
See Also:
Connector.beforeCompletion()

flush

public void flush()
Get a connection, process the message by using that connection to interact with the database, read back the reply, release the connection.

Specified by:
flush in interface org.apache.jdo.store.Connector
See Also:
Connector.flush()

commit

public void commit()
Add a CommitRequest to the connector's message, and send it to the store. Then close the connection.

Specified by:
commit in interface org.apache.jdo.store.Connector
See Also:
Connector.commit()

rollback

public void rollback()
If rollbackOnly is set, then the store has already done a rollback, so we don't do one now (but neither do we throw an exception, as do other methds).

Specified by:
rollback in interface org.apache.jdo.store.Connector
See Also:
Connector.rollback(), ReplyHandler.processReplies(java.io.DataInput, org.apache.jdo.impl.fostore.Message)

setRollbackOnly

public void setRollbackOnly()
Specified by:
setRollbackOnly in interface org.apache.jdo.store.Connector
See Also:
Connector.setRollbackOnly()

getRollbackOnly

public boolean getRollbackOnly()
Specified by:
getRollbackOnly in interface org.apache.jdo.store.Connector
See Also:
Connector.getRollbackOnly()

getMessage

Message getMessage()
Provides the Message which this this connector uses to send data to the store.


assertNotRollbackOnly

private void assertNotRollbackOnly()

assertNotBusy

private void assertNotBusy(java.lang.String methodName)