AGDisconnecting.java
package com.franz.ag.examples;
import com.franz.ag.*;
public class AGDisconnecting {
@param
@throws
public static void main(String[] args) throws AllegroGraphException {
System.out.println("Attempting to connect to the default server.");
AllegroGraphConnection ags = new AllegroGraphConnection();
try {
ags.enable();
} catch (Exception e) {
throw new AllegroGraphException("Server connection problem -- please ensure the default server is running.", e);
}
System.out.println("Connected to the server on port " + ags.getPort());
System.out.println("Disconnecting from the server.");
ags.disable();
System.out.println("Connection status enabled? " + ags.isEnabled());
System.out.println("Attempting to reconnect.");
try {
ags.enable();
} catch (Exception e) {
throw new AllegroGraphException("Server connection problem -- please ensure the default server is running.", e);
}
System.out.println("Reconnected to the server on port " + ags.getPort());
AGServerInfo.showConnectionInstanceInfo(ags);
System.out.println("Disconnecting from the server.");
ags.disable();
System.out.println("Done.");
}
}
Up |
Next