Class ClientSession

java.lang.Object
com.bea.wcp.diameter.Session
com.bea.wcp.diameter.accounting.ClientSession
All Implemented Interfaces:
Externalizable, Serializable
Direct Known Subclasses:
RfSession

public class ClientSession extends Session
Client accounting session implementing the client accounting state machine described in RFC 3588 section 8.2. This session can be used to create and send new ACR accounting requests, and receive corresponding ACA answer messages. The current session state is based on the accounting record type of the previously created request. For an EVENT ACR, the session will be terminated (removed from the Diameter session map) as soon as the corresponding EVENT ACA message is received. Likewise, after STOP ACR is sent, the session will be terminated as soon as the corresponding STOP ACA message is received.
Author:
Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
See Also:
  • Constructor Details

    • ClientSession

      public ClientSession()
      Used by Externalizable.
    • ClientSession

      public ClientSession(Application app)
      Creates a new ClientSession for the specified application.
    • ClientSession

      public ClientSession(Application app, String id, Object parent)
  • Method Details

    • createACR

      public ACR createACR(RecordType type)
      Creates a new accounting request (ACR) for the specified accounting record type. For a newly created ClientSession, the first ACR request must be either an EVENT request for event-based accounting, or a START request for session-based accounting. If an EVENT request, then this must be the only request created for the session, and the session will be terminated automatically upon receipt of the corresponding EVENT ACA message. If a START request, then this must be followed by zero or more INTERIM requests, and finally a terminating STOP request. Upon receiving the STOP ACA message, the session will be automatically terminated.
      Parameters:
      type - the accounting RecordType for the request
      Returns:
      the resulting ACR request for this session
      Throws:
      IllegalStateException - if the session is terminated, a request is currently pending, or the specified RequestType is not valid for the current session state
    • sndMessage

      public void sndMessage(Message msg) throws IOException
      Called by the container just before a new ACR or ACA message has been sent out. The current session state is updated accordingly.
      Overrides:
      sndMessage in class Session
      Parameters:
      msg - the ACR/ACA message being sent out
      Throws:
      IOException - if the message could not be sent
      IllegalStateException - if the session has been terminated, a request is already pending, or a request is out of sequence (invalid record number)
    • rcvAnswer

      protected void rcvAnswer(Answer ans) throws DiameterException, IOException
      Receives accounting answer (ACA) messages for this session. The session state machine will be updated according to ACA record number and type. If ACA record type is EVENT or STOP then the session will be automatically terminated.
      Overrides:
      rcvAnswer in class Session
      Parameters:
      ans - the ACA message
      Throws:
      DiameterException - if a Diameter protocol error occurred
      IOException - if an I/O error occurred while processing the message
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Overrides:
      writeExternal in class Session
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput is) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Overrides:
      readExternal in class Session
      Throws:
      IOException
      ClassNotFoundException