jxDBCon 0.9z

org.sourceforge.jxdbcon.postgresql
Class NetProtocolV2Async

java.lang.Object
  |
  +--org.sourceforge.jxdbcon.postgresql.NetProtocol
        |
        +--org.sourceforge.jxdbcon.postgresql.NetProtocolV1
              |
              +--org.sourceforge.jxdbcon.postgresql.NetProtocolV2
                    |
                    +--org.sourceforge.jxdbcon.postgresql.NetProtocolV2Async
All Implemented Interfaces:
InfoKeys, PGConstants, PGInfoKeys, PGProtocol, Runnable

public class NetProtocolV2Async
extends NetProtocolV2
implements Runnable

Asynchronous frontend/backend protocol. This protocol is selected by the UseAsync key when connecting. It can be used for real-time LISTEN/NOTIFY handling.


Nested Class Summary
 
Nested classes inherited from class org.sourceforge.jxdbcon.postgresql.NetProtocolV2
NetProtocolV2.BackendKeyData, NetProtocolV2.ReadyForQuery
 
Nested classes inherited from class org.sourceforge.jxdbcon.postgresql.NetProtocolV1
NetProtocolV1.AsciiRow, NetProtocolV1.Authentication, NetProtocolV1.BinaryRow, NetProtocolV1.CompletedResponse, NetProtocolV1.CursorResponse, NetProtocolV1.EmptyQueryResponse, NetProtocolV1.EmptyResponse, NetProtocolV1.ErrorResponse, NetProtocolV1.FunctionResult, NetProtocolV1.MessageResponse, NetProtocolV1.NoticeResponse, NetProtocolV1.NotificationResponse, NetProtocolV1.Response, NetProtocolV1.RowDescription
 
Field Summary
private  boolean goon
          Flag for read loop.
private  LinkedList lst
          List of incoming messages.
private  Object lstLock
          Lock for the linked list.
private  Thread thread
          The read loop's thread.
 
Fields inherited from class org.sourceforge.jxdbcon.postgresql.NetProtocolV2
 
Fields inherited from class org.sourceforge.jxdbcon.postgresql.NetProtocolV1
nFields
 
Fields inherited from class org.sourceforge.jxdbcon.postgresql.NetProtocol
copyInStream, copyOutStream, in, lock, messageEncoding, out, socket
 
Fields inherited from interface org.sourceforge.jxdbcon.postgresql.PGConstants
AUTH_REQ_CRYPT, AUTH_REQ_KRB4, AUTH_REQ_KRB5, AUTH_REQ_MD5, AUTH_REQ_OK, AUTH_REQ_PASSWORD, AUTH_REQ_SCM, NUMERIC_DSCALE_MASK, NUMERIC_NAN, NUMERIC_NEG, NUMERIC_POS, NUMERIC_SIGN_MASK, PG_VERSION_STR, PG_VERSION_STR1, TRIGGER_TYPE_BEFORE, TRIGGER_TYPE_DELETE, TRIGGER_TYPE_INSERT, TRIGGER_TYPE_ROW, TRIGGER_TYPE_UPDATE
 
Fields inherited from interface org.sourceforge.jxdbcon.postgresql.PGInfoKeys
FORCECLIENTENC, OPTIONS, PROTOVERSION, SETTIMEZONE, STRICTSCHEMA, TTY, USEASYNC, USECLIENTENC, USEDBENC, USESSL
 
Fields inherited from interface org.sourceforge.jxdbcon.InfoKeys
CATALOG, DESCRIPTION, DRIVER, HOST, PASSWORD, PORT, SUBDRIVER, USER
 
Constructor Summary
NetProtocolV2Async()
           
 
Method Summary
protected  void connectSocket(Properties info)
          Connect to the backend and start the read loop.
protected  NetProtocolV1.Response readFirst()
          Return the first message from the backend.
 void run()
          Do the read loop.
protected  void sendClose()
          Send the close command.
 String toString()
           
 
Methods inherited from class org.sourceforge.jxdbcon.postgresql.NetProtocolV2
close, connect, dispatch, doLogin, exec, exec, requestCancel, sendStartup
 
Methods inherited from class org.sourceforge.jxdbcon.postgresql.NetProtocolV1
sendFunctionCall, sendPassword, sendQuery, sendStartup
 
Methods inherited from class org.sourceforge.jxdbcon.postgresql.NetProtocol
limString, readCString, setCopyInStream, setCopyOutStream, setMessageEncoding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

goon

private boolean goon
Flag for read loop.


lst

private LinkedList lst
List of incoming messages.


lstLock

private Object lstLock
Lock for the linked list.


thread

private Thread thread
The read loop's thread.

Constructor Detail

NetProtocolV2Async

public NetProtocolV2Async()
Method Detail

connectSocket

protected void connectSocket(Properties info)
                      throws IOException
Connect to the backend and start the read loop. Once the connection is established the read-loops thread is started.

Overrides:
connectSocket in class NetProtocol
IOException

readFirst

protected NetProtocolV1.Response readFirst()
                                    throws InterruptedException
Return the first message from the backend. This method blocks until the message list has an item to retrieve.

Overrides:
readFirst in class NetProtocolV1
Throws:
InterruptedException - if the operation was interrupted

run

public void run()
Do the read loop.

Specified by:
run in interface Runnable

sendClose

protected void sendClose()
                  throws IOException
Send the close command. This method additionally signals the read-loop to end its operation.

Overrides:
sendClose in class NetProtocolV1
IOException

toString

public String toString()
Overrides:
toString in class Object

jxDBCon 0.9z

Copyright © 2001,2002 Keve Müller; see LICENSE file for details.