All LDAP Classes
Internal LDAP Classes

com.novell.ldap
Class Message

java.lang.Object
  extended by com.novell.ldap.Message

 class Message
extends java.lang.Object

Encapsulates an LDAP message, its state, and its replies.


Nested Class Summary
private  class Message.Timeout
          Timer class to provide timing for messages.
 
Field Summary
private  boolean acceptReplies
           
private  MessageAgent agent
           
private  BindProperties bindprops
           
private  boolean complete
           
private  Connection conn
           
private  LDAPMessage msg
           
private  int msgId
           
private  int mslimit
           
private  java.lang.String name
           
private  LDAPMessageQueue queue
           
private  MessageVector replies
           
private  java.lang.Thread timer
           
private  boolean waitForReply
           
 
Constructor Summary
Message(LDAPMessage msg, int mslimit, Connection conn, MessageAgent agent, LDAPMessageQueue queue, BindProperties bindprops)
          Constructs a Message class encapsulating information about this message.
 
Method Summary
(package private)  void abandon(LDAPConstraints cons, InterThreadException informUserEx)
          abandon a request.
(package private)  boolean acceptsReplies()
          Returns true if replies are accepted for this request.
private  void cleanup()
          Release reply messages
protected  void finalize()
          finalize
(package private)  int getCount()
          Get number of messages queued.
(package private)  MessageAgent getMessageAgent()
          gets the MessageAgent associated with this message
(package private)  int getMessageID()
          gets the Message ID associated with this message request
(package private)  int getMessageType()
          gets the Message Type associated with this message request
(package private)  java.lang.Object getReply()
          Gets the next reply from the reply queue if one exists
(package private)  LDAPMessage getRequest()
          gets the LDAPMessage request associated with this message
(package private)  boolean hasReplies()
          Returns true if replies are queued
(package private)  boolean isBindRequest()
          Returns true if this message is a bind request
(package private)  boolean isComplete()
          gets the operation complete status for this message
(package private)  void putReply(RfcLDAPMessage message)
          Puts a reply on the reply queue
(package private)  void refuseReplies()
          prevents future replies from being accepted for this request
(package private)  void sendMessage()
          This method write the message on the wire.
(package private)  void setAgent(MessageAgent agent)
          sets the agent for this message
private  void sleepersAwake()
          Notifies all waiting threads
(package private)  void stopTimer()
          stops the timeout timer from running
(package private)  java.lang.Object waitForReply()
          Gets the next reply from the reply queue or waits until one is there
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

msg

private LDAPMessage msg

conn

private Connection conn

agent

private MessageAgent agent

queue

private LDAPMessageQueue queue

mslimit

private int mslimit

timer

private java.lang.Thread timer

replies

private MessageVector replies

msgId

private int msgId

acceptReplies

private boolean acceptReplies

waitForReply

private boolean waitForReply

complete

private boolean complete

name

private java.lang.String name

bindprops

private BindProperties bindprops
Constructor Detail

Message

Message(LDAPMessage msg,
        int mslimit,
        Connection conn,
        MessageAgent agent,
        LDAPMessageQueue queue,
        BindProperties bindprops)
Constructs a Message class encapsulating information about this message.

Parameters:
msg - the message to send to the server

mslimit - number of milliseconds to wait before the message times out.

conn - the connection used to send this message

agent - the MessageAgent handling this message.

queue - the application LDAPMessageQueue for this message
Method Detail

sendMessage

final void sendMessage()
                throws LDAPException
This method write the message on the wire. It MUST never be called more than once. Previously we were sending the message in the constructor, but that opens a small timing window where a reply could return before the code returns and this object gets queued on the MessageAgentQueue. In that small case, the application would not wake up on the reply. Making this method separate, closes that window but opens the possibility for misuse. We do not enforce the requirement that it be called only once as that adds extra synchronization. We depend on the interal API to act correctly. When the message is sent, the timer thread is started to time the message.

Throws:
LDAPException

hasReplies

boolean hasReplies()
Returns true if replies are queued

Returns:
false if no replies are queued, otherwise true

getCount

int getCount()
Get number of messages queued. Don't count the last message containing result code.


acceptsReplies

boolean acceptsReplies()
Returns true if replies are accepted for this request.

Returns:
false if replies are no longer accepted for this request

refuseReplies

void refuseReplies()
prevents future replies from being accepted for this request


setAgent

void setAgent(MessageAgent agent)
sets the agent for this message


stopTimer

void stopTimer()
stops the timeout timer from running


sleepersAwake

private void sleepersAwake()
Notifies all waiting threads


isComplete

boolean isComplete()
gets the operation complete status for this message

Returns:
the true if the operation is complete, i.e. the LDAPResult has been received.

getMessageAgent

MessageAgent getMessageAgent()
gets the MessageAgent associated with this message

Returns:
the MessageAgent associated with this message

getRequest

LDAPMessage getRequest()
gets the LDAPMessage request associated with this message

Returns:
the LDAPMessage request associated with this message

getMessageID

int getMessageID()
gets the Message ID associated with this message request

Returns:
the Message ID associated with this message request

getMessageType

int getMessageType()
gets the Message Type associated with this message request

Returns:
the Message Type associated with this message request

putReply

void putReply(RfcLDAPMessage message)
Puts a reply on the reply queue

Parameters:
message - the RfcLDAPMessage to put on the reply queue.

waitForReply

java.lang.Object waitForReply()
Gets the next reply from the reply queue or waits until one is there

Returns:
the next reply message on the reply queue or null

getReply

java.lang.Object getReply()
Gets the next reply from the reply queue if one exists

Returns:
the next reply message on the reply queue or null if none

abandon

void abandon(LDAPConstraints cons,
             InterThreadException informUserEx)
abandon a request. All queued replies are discarded. The message is removed from the connection and agent lists. Any client threads waiting on this request are notified.

Parameters:
cons - and LDAPConstraints associated with the abandon.

informUserEx - true if user must be informed of operation

cleanup

private void cleanup()
Release reply messages


isBindRequest

final boolean isBindRequest()
Returns true if this message is a bind request

Returns:
true if a bind request

finalize

protected final void finalize()
                       throws java.lang.Throwable
finalize

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

All LDAP Classes
Internal LDAP Classes

Copyright ? 2002 Novell, Inc. All Rights Reserved.
Novell, Inc.
1800 South Novell Place
Provo, Ut 84606
Phone: (801) 861-5000