Crossfire JXClient, Trunk
|
Go to the documentation of this file.
41 package com.sun.jmx.examples.scandir;
48 import java.io.FileOutputStream;
49 import java.io.IOException;
50 import java.io.OutputStream;
51 import java.util.Collections;
52 import java.util.LinkedList;
53 import java.util.List;
54 import java.util.logging.Logger;
55 import javax.management.MBeanNotificationInfo;
56 import javax.management.MBeanRegistration;
57 import javax.management.MBeanServer;
58 import javax.management.Notification;
59 import javax.management.NotificationBroadcasterSupport;
60 import javax.management.ObjectName;
61 import javax.xml.bind.JAXBException;
93 private static final Logger
LOG =
150 Collections.synchronizedList(
new LinkedList<ResultRecord>() {
153 while (max > 0 &&
size() >= max) {
247 }
catch (Exception x) {
248 LOG.finest(
"Failed to close log properly: "+x);
272 final OutputStream newStream;
274 if ((force==
false) && (
logCount < maxRecords))
276 final OutputStream oldStream =
logStream;
281 if (oldStream !=
null) {
287 newStream = (newFile==
null)?
null:
new FileOutputStream(newFile,
true);
329 synchronized (
this) {
375 getNextSeqNumber(),
"memory log cleared"));
396 if (before==
false && after==
true)
399 getNextSeqNumber(),
"memory log capacity reached"));
407 final String basename;
408 final long maxRecords;
409 synchronized (
this) {
416 final OutputStream stream =
420 if (stream ==
null)
return;
422 synchronized (
this) {
428 }
catch (JAXBException x) {
429 final IllegalArgumentException iae =
430 new IllegalArgumentException(
"bad record",x);
431 LOG.finest(
"Failed to log record: "+x);
444 "com.sun.jmx.examples.scandir.log.file.switched";
452 "com.sun.jmx.examples.scandir.log.memory.full";
460 "com.sun.jmx.examples.scandir.log.memory.cleared";
471 return new MBeanNotificationInfo[] {
472 new MBeanNotificationInfo(
new String[] {
474 Notification.class.getName(),
475 "Emitted when the log file is switched")
477 new MBeanNotificationInfo(
new String[] {
479 Notification.class.getName(),
480 "Emitted when the memory log capacity is reached")
482 new MBeanNotificationInfo(
new String[] {
484 Notification.class.getName(),
485 "Emitted when the memory log is cleared")
492 synchronized (
this) {
493 if (
logFile ==
null)
return null;
494 if (absolute)
return logFile.getAbsolutePath();
503 if (logConfigBean ==
null)
504 throw new IllegalArgumentException(
"logConfigBean is null");
505 synchronized (
this) {
511 if ((filename !=
null && !filename.equals(logname))
512 || (filename ==
null && logname !=
null)) {
volatile long fileCapacity
String getLogFileName(boolean absolute)
volatile boolean memCapacityReached
File createNewLogFile(String basename)
void postRegister(Boolean registrationDone)
static final String LOG_FILE_CHANGED
static final ObjectName makeSingletonName(Class clazz)
void logToFile(ResultRecord record)
long getLogFileMaxRecords()
int getMemoryMaxRecords()
MBeanNotificationInfo[] getNotificationInfo()
Font2DTest To run then you should either specify the complete path to the commands or update your PATH environment variable as described in the installation instructions for the load Font2DTest html If you wish to modify any of the source you may want to extract the contents of the Font2DTest jar file by executing this the browser plugin viewer needs following permissions given in order to run but some of its features will be limited To enable all please add these permissions with policytool Introduction Font2DTest is an encompassing application for testing various fonts found on the user s system A number of controls are available to change many attributes of the current font including size
void log(ResultRecord record)
long getLogFileCapacity()
in the editor and run the same with Tools Run menu You will see an alert box with the message world In addition to being a simple script editor scriptpad can be used to connect to a JMX MBean server("Tools->JMX Connect" menu). User can specify JMX hostname and port. After connecting
ObjectName preRegister(MBeanServer server, ObjectName name)
static File createNewXmlFile(String basename)
void logToMemory(ResultRecord record)
void setLogFileCapacity(long maxRecords)
volatile ResultLogConfig config
static void write(ScanManagerConfig bean, OutputStream os, boolean fragment)
OutputStream checkLogFile(String basename, long maxRecords, boolean force)
void setMemoryLogCapacity(int maxRecords)
void setMemoryMaxRecords(int memoryMaxRecords)
void setConfig(ResultLogConfig logConfigBean)
int getMemoryLogCapacity()
static final String MEMORY_LOG_MAX_CAPACITY
static synchronized long getNextSeqNumber()
void newLogFile(String logname, long maxRecord)
static final String MEMORY_LOG_CLEARED
ResultRecord[] getMemoryLog()
volatile OutputStream logStream
void setLogFileMaxRecords(long logFileMaxRecords)
static final ObjectName RESULT_LOG_MANAGER_NAME
final List< ResultRecord > memoryLog
ResultLogConfig getConfig()
A Simple Chat Server Example the server takes input from a it handles the startup and handles incoming connections on the listening sockets It keeps a list of connected client and provides methods for sending a message to them Client represents a connected it provides methods for reading writing from to the underlying socket It also contains a buffer of input read from the user DataReader provides the interface of the two states a user can be in Waiting for a name(and not receiving any messages while doing so, implemented by NameReader) and waiting for messages from the user(implemented by MessageReader). ClientReader contains the "main loop" for a connected client. NameReader is the initial state for a new client
void setLogFileName(String logFileName)