|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface ConnectionAttemptListener
This interface prescribes methods for a class that listens for connection attempts performed by a ConnectionFactory object.
You can implement this interface if you want to create a class that is notified about the status of connection attempts made by a ConnectionFactory object. The methods of the interface are called as the connection attempt proceeds. Your class might use that information to create a connection attempt log for example.
Note that the listener is only notified when a connection is actually attempted. If the specified transport type is not
available, the factory will not attempt to make a connection and the listener will not be notified. The TransportInfo.isTransportTypeAvailable(int)
method enables you to check if a certain transport type is available.
A class that implements this interface should not block and should return as quickly as possible.
ConnectionFactory.setConnectionAttemptListener(ConnectionAttemptListener connectionAttemptListener)| Method Summary | ||
|---|---|---|
void |
attemptAborted(String url,
Exception exception)
The ConnectionFactory will call this method if no connection can be attempted (for example, no transport is available, invalid arguments, etc.) |
|
void |
attemptFailed(TransportDescriptor transport,
int attemptNumber,
String url,
Exception exception)
The ConnectionFactory will call this method if the call to Connector.open() failed. |
|
void |
attemptSucceeded(int attemptNumber,
ConnectionDescriptor connection)
The ConnectionFactory will call this method if the call to Connector.open() was successful. |
|
boolean |
attempting(TransportDescriptor transport,
int attemptNumber,
String url)
The ConnectionFactory will call this method just before attempting the connection. |
|
| Method Detail |
|---|
boolean attempting(TransportDescriptor transport,
int attemptNumber,
String url)
transport - a TransportDescriptor that describes the exact transport instance being attemptedattemptNumber - a number identifying the attempt in the case of multiple retriesurl - a String with the full URL passed to Connector.open()
true if the attempt should proceed.false if the attempt should be canceled.
Note that returning false will cause the factory to return null immediately.
void attemptSucceeded(int attemptNumber,
ConnectionDescriptor connection)
attemptNumber - a number identifying the attempt in the case of multiple retriesconnection - a ConnectionDescriptor of the opened connection
void attemptFailed(TransportDescriptor transport,
int attemptNumber,
String url,
Exception exception)
transport - a TransportDescriptor that describes the exact transport attemptedattemptNumber - a number identifying the attempt in the case of multiple retriesurl - a String with the full URL passed to Connector.open()exception - an Exception if available (i.e. exception may be null)
void attemptAborted(String url,
Exception exception)
url - a String with the URL passed to the factoryexception - an Exception if available (i.e. exception may be null)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal