public final void run() { for (int i = 0; i < devices.size(); i++) { try { LinuxDevice device = (LinuxDevice)devices.get(i); device.close(); } catch (IOException e) { logln("Failed to close device: " + e.getMessage()); } } } }
public final Object run() { String lib_path = System.getProperty("net.java.games.input.librarypath"); try { if (lib_path != null) System.load(lib_path + File.separator + System.mapLibraryName(lib_name)); else System.loadLibrary(lib_name); } catch (UnsatisfiedLinkError e) { logln("Failed to load library: " + e.getMessage()); e.printStackTrace(); supported = false; } return null; } });
/** * Creates a new EventQueue. Events in old queue are lost. */ public final void setEventQueueSize(int size) { try { setDeviceEventQueueSize(size); event_queue = new EventQueue(size); } catch (IOException e) { ControllerEnvironment.logln("Failed to create new event queue of size " + size + ": " + e); } }
private void scanControllersAt(String path) { File file = new File(path); if (!file.exists()) { return; } try { Plugins plugins = new Plugins(file); Class[] envClasses = plugins.getExtends(ControllerEnvironment.class); for(int i=0;i<envClasses.length;i++){ try { ControllerEnvironment.logln("ControllerEnvironment "+ envClasses[i].getName() +" loaded by "+envClasses[i].getClassLoader()); ControllerEnvironment ce = (ControllerEnvironment) envClasses[i].newInstance(); if(ce.isSupported()) { addControllers(ce.getControllers()); loadedPlugins.add(ce.getClass().getName()); } else { logln(envClasses[i].getName() + " is not supported"); } } catch (Throwable e) { e.printStackTrace(); } } } catch (Exception e) { e.printStackTrace(); } }
ControllerEnvironment.logln("Failed to poll device: " + e.getMessage()); return false;