Methods Summary |
---|
private native void | finalize()Performs clean up upon object destruction.
Removes current isolate from the list of isolates interested in
receiving mount/unmount events.
|
public boolean | preprocess(Event event, Event waitingEvent)Preprocess an event that is being posted to the event queue.
This method will get called in the thread that posted the event.
if (event.getType() != EventTypes.FC_DISKS_CHANGED_EVENT) {
return false;
}
if (waitingEvent != null) {
return false;
}
return true;
|
public void | process(Event event)Process an event.
This method will get called in the event queue processing thread.
if (event.getType() != EventTypes.FC_DISKS_CHANGED_EVENT) {
return;
}
// Get up-to-date roots list from OS
Vector newRoots = Protocol.listRoots();
// Get cached roots list from FileSystemRegistry
Vector oldRoots = new Vector(newRoots.size() + 1);
for (Enumeration e = FileSystemRegistry.listCachedRoots();
e.hasMoreElements();) {
oldRoots.addElement(e.nextElement());
}
// Find all removed roots and notify FileSystemRegistry about them
for (int i = 0; i < oldRoots.size(); i++) {
String root = (String)oldRoots.elementAt(i);
if (!newRoots.contains(root)) {
FileSystemRegistry.removeRoot(root);
} else {
newRoots.removeElement(root);
}
}
// Notify FileSystemRegistry about all added roots if any
for (int i = 0; i < newRoots.size(); i++) {
String root = (String)newRoots.elementAt(i);
FileSystemRegistry.addRoot(root);
}
|
private native void | registerListener()Registers current isolate as interested in receiving mount/unmount
events.
|
static void | setListener(EventListener l)Register the event listener in the event queue.
Security note: access specifier for this method is 'package private'
so only classes from this package can access it.
// Listener can be set only once.
if (listener != null) {
return;
}
listener = l;
EventQueue evtq = EventQueue.getEventQueue(classSecurityToken);
evtq.registerEventListener(EventTypes.FC_DISKS_CHANGED_EVENT, listener);
|