List of usage examples for java.lang Thread setName
public final synchronized void setName(String name)
From source file:org.apache.hadoop.hive.metastore.HiveMetaStore.java
/** * Start threads outside of the thrift service, such as the compactor threads. * @param conf Hive configuration object *///from w ww .j a va 2s .c o m private static void startMetaStoreThreads(final HiveConf conf, final Lock startLock, final Condition startCondition, final AtomicBoolean startedServing) { // A thread is spun up to start these other threads. That's because we can't start them // until after the TServer has started, but once TServer.serve is called we aren't given back // control. Thread t = new Thread() { @Override public void run() { // This is a massive hack. The compactor threads have to access packages in ql (such as // AcidInputFormat). ql depends on metastore so we can't directly access those. To deal // with this the compactor thread classes have been put in ql and they are instantiated here // dyanmically. This is not ideal but it avoids a massive refactoring of Hive packages. // // Wrap the start of the threads in a catch Throwable loop so that any failures // don't doom the rest of the metastore. startLock.lock(); try { JvmPauseMonitor pauseMonitor = new JvmPauseMonitor(conf); pauseMonitor.start(); } catch (Throwable t) { LOG.warn("Could not initiate the JvmPauseMonitor thread." + " GCs and Pauses may not be " + "warned upon.", t); } try { // Per the javadocs on Condition, do not depend on the condition alone as a start gate // since spurious wake ups are possible. while (!startedServing.get()) startCondition.await(); startCompactorInitiator(conf); startCompactorWorkers(conf); startCompactorCleaner(conf); startHouseKeeperService(conf); } catch (Throwable e) { LOG.error("Failure when starting the compactor, compactions may not happen, " + StringUtils.stringifyException(e)); } finally { startLock.unlock(); } ReplChangeManager.scheduleCMClearer(conf); } }; t.setDaemon(true); t.setName("Metastore threads starter thread"); t.start(); }
From source file:ECallCenter21.java
private void startJConsole() { Thread startJConsoleThread = new Thread(new Runnable() { @Override/*from w w w. ja v a2s . com*/ @SuppressWarnings({ "static-access" }) public void run() { String[] status = new String[2]; showStatus("Starting JConsole", true, true); status[0] = "0"; status[1] = ""; shell.startJConsole(); if (status[0].equals("0")) { showStatus(status[1], true, true); } else { showStatus(status[1], true, true); } return; } }); startJConsoleThread.setName("startJConsoleThread"); startJConsoleThread.setDaemon(runThreadsAsDaemons); startJConsoleThread.start(); }
From source file:ECallCenter21.java
/** * *//*from w w w. j av a2 s.co m*/ public void startEPhoneGUI() { Thread startEPhoneGUIThread = new Thread(new Runnable() { @Override @SuppressWarnings({ "static-access" }) public void run() { String[] status = new String[2]; showStatus("Starting EPhone", true, true); status[0] = "0"; status[1] = ""; shell.startEPhone(""); if (status[0].equals("0")) { showStatus(status[1], true, true); } else { showStatus(status[1], true, true); } return; } }); startEPhoneGUIThread.setName("startEPhoneGUIThread"); startEPhoneGUIThread.setDaemon(runThreadsAsDaemons); startEPhoneGUIThread.start(); }
From source file:ECallCenter21.java
private void endButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_endButtonActionPerformed Thread outboundEndButtonActionPerformedThread8 = new Thread(allThreadsGroup, new Runnable() { @Override// w w w . j av a 2 s . co m public void run() { serviceLoopProgressBar.setEnabled(true); endCounter = 0; showStatus("Sending End Button Activation to SoftPhones...", true, true); /* true = logToApplic, true = logToFile */ while (endCounter < outboundSoftPhonesAvailable) // Starts looping through the user-range { // Creating a temp reference to softphone instance in loop Thread endThread = new Thread(allThreadsGroup, new Runnable() { @Override public void run() { String[] status = new String[2]; SoftPhone thisSoftPhoneInstance = (SoftPhone) threadArray[endCounter]; status = thisSoftPhoneInstance.userInput(ENDBUTTON, "", "", ""); if (status[0].equals("1")) { showStatus("End Failure: " + status[1], true, true); /* true = logToApplic, true = logToFile */ } } }); endThread.setName("endThread"); endThread.setDaemon(runThreadsAsDaemons); endThread.start(); try { Thread.sleep(smoothMovementPeriod); } catch (InterruptedException ex) { } phoneStatsTable.setValueAt(endCounter + 1, 1, 1); // ProcessingInstance serviceLoopProgressBar.setValue(endCounter); endCounter++; } showStatus("Sending End Button Activation to SoftPhones Completed", true, true); /* true = logToApplic, true = logToFile */ phoneStatsTable.setValueAt("-", 1, 1); // ProcessingInstance serviceLoopProgressBar.setValue(0); serviceLoopProgressBar.setEnabled(false); return; } }); outboundEndButtonActionPerformedThread8.setName("outboundEndButtonActionPerformedThread8"); outboundEndButtonActionPerformedThread8.setDaemon(runThreadsAsDaemons); outboundEndButtonActionPerformedThread8.start(); }
From source file:ECallCenter21.java
private void callButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_callButtonActionPerformed Thread outboundEndButtonActionPerformedThread8 = new Thread(allThreadsGroup, new Runnable() { @Override/*from w w w . j a v a 2s .c om*/ public void run() { serviceLoopProgressBar.setEnabled(true); callCounter = 0; showStatus("Sending Call Button Activation to SoftPhones...", true, true); /* true = logToApplic, true = logToFile */ while (callCounter < outboundSoftPhonesAvailable) // Starts looping through the user-range { // Creating a temp reference to softphone instance in loop Thread callButtonThread = new Thread(allThreadsGroup, new Runnable() { @Override public void run() { String[] status = new String[2]; SoftPhone thisSoftPhoneInstance = (SoftPhone) threadArray[callCounter]; status = thisSoftPhoneInstance.userInput(CALLBUTTON, "", "", ""); if (status[0].equals("1")) { showStatus("Call Failure: " + status[1], true, true); /* true = logToApplic, true = logToFile */ } } }); callButtonThread.setName("callButtonThread"); callButtonThread.setDaemon(runThreadsAsDaemons); callButtonThread.start(); try { Thread.sleep(smoothMovementPeriod); } catch (InterruptedException ex) { } phoneStatsTable.setValueAt(callCounter + 1, 1, 1); // ProcessingInstance serviceLoopProgressBar.setValue(callCounter); callCounter++; } showStatus("Sending Call Button Activation to SoftPhones Completed", true, true); /* true = logToApplic, true = logToFile */ phoneStatsTable.setValueAt("-", 1, 1); // ProcessingInstance serviceLoopProgressBar.setValue(0); serviceLoopProgressBar.setEnabled(false); return; } }); outboundEndButtonActionPerformedThread8.setName("outboundEndButtonActionPerformedThread8"); outboundEndButtonActionPerformedThread8.setDaemon(runThreadsAsDaemons); outboundEndButtonActionPerformedThread8.start(); }
From source file:ECallCenter21.java
private void phonesPoolTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_phonesPoolTableMouseClicked if (evt.getClickCount() == 2) { myCoordinate = new Coordinate(phonesPoolTable.getSelectedRow(), phonesPoolTable.getSelectedColumn()); final int selectedSoftPhoneInstance = getSoftPhoneInstance(myCoordinate); // Calculate the SoftPhone instance according the selected coordinate final SoftPhone softPhoneInstance = (SoftPhone) threadArray[selectedSoftPhoneInstance]; // Get the related SoftPhone instance reference softPhoneInstance.setEPhoneGUIActive(true); Thread selectPhoneThread = new Thread(allThreadsGroup, new Runnable() { @Override/*from w w w . j a v a2 s. com*/ public void run() { java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { EPhone mySoftPhoneGUI = new EPhone(softPhoneInstance); // SoftPhoneGUI usually tied up with new SoftPhone instance, but in this case it's not a new instance it's an existing instance mySoftPhoneGUI.setVisible(true); softPhoneInstance.setUserInterface2(mySoftPhoneGUI); softPhoneInstance.updateDisplay(); } }); } }); selectPhoneThread.setName("selectPhoneThread"); selectPhoneThread.setDaemon(runThreadsAsDaemons); selectPhoneThread.setPriority(4); selectPhoneThread.start(); } }
From source file:ECallCenter21.java
/** * * @param responseCodeParam/* www . j a va 2s. co m*/ * @param responseReasonPhraseParam * @param softPhoneInstanceIdParam * @param destinationParam */ @Override synchronized public void responseUpdate(final int responseCodeParam, final String responseReasonPhraseParam, final int softPhoneInstanceIdParam, final Destination destinationParam) // Mainly used for the systemStatsTable in this gui { if (destinationParam.getResponseStatusCode() == 404) { dbClient.updateDestination(destinationParam); } // infoTally, successTally, redirectionTally, clientErrorTally, serverErrorTally, generalErrorTally; if ((responseCodeParam >= 100) && (responseCodeParam < 200)) { infoTally++; } if ((responseCodeParam >= 200) && (responseCodeParam < 300)) { successTally++; } if ((responseCodeParam >= 300) && (responseCodeParam < 400)) { redirectionTally++; logToApplication("Redirection: " + responseCodeParam + " " + responseReasonPhraseParam + " Instance: " + softPhoneInstanceIdParam + " Phonenumber: " + destinationParam.getDestination()); } if ((responseCodeParam >= 400) && (responseCodeParam < 500)) { clientErrorTally++; if ((responseCodeParam != 401) && (responseCodeParam != 486)) { logToApplication( "Client Error: " + responseCodeParam + " " + responseReasonPhraseParam + " Instance: " + softPhoneInstanceIdParam + " Phonenumber: " + destinationParam.getDestination()); } } if ((responseCodeParam >= 500) && (responseCodeParam < 600)) { serverErrorTally++; logToApplication("Server Error: " + responseCodeParam + " " + responseReasonPhraseParam + " Instance: " + softPhoneInstanceIdParam + " Phonenumber: " + destinationParam.getDestination()); } if ((responseCodeParam >= 600) && (responseCodeParam < 700)) { generalErrorTally++; logToApplication("General Error: " + responseCodeParam + " " + responseReasonPhraseParam + " Instance: " + softPhoneInstanceIdParam + " Phonenumber: " + destinationParam.getDestination()); } if (responseCodeParam == 0) { timeoutTally++; } Thread responseUpdateThread = new Thread(allThreadsGroup, new Runnable() // responseUpdateThreadPool.execute(new Runnable() { @Override public void run() { responseStatsTable.setValueAt(infoTally, 0, 2); // onCell responseStatsTable.setValueAt(successTally, 1, 2); // idleCell responseStatsTable.setValueAt(redirectionTally, 2, 2); // wait_prov responseStatsTable.setValueAt(clientErrorTally, 3, 2); // wait_final responseStatsTable.setValueAt(serverErrorTally, 4, 2); // wait_act responseStatsTable.setValueAt(generalErrorTally, 5, 2); // calling responseStatsTable.setValueAt(timeoutTally, 11, 2); // calling } }); responseUpdateThread.setName("responseUpdateThread"); responseUpdateThread.setDaemon(runThreadsAsDaemons); responseUpdateThread.start(); }
From source file:ECallCenter21.java
private void initSlidersSmooth() { Thread inboundBurstRateSliderThread = new Thread(allThreadsGroup, new Runnable() { @Override/* w ww . j a v a 2 s . co m*/ public void run() { int counter = 0; int to = registerSpeedSlider.getValue(); while (counter < to) { registerSpeedSlider.setValue(counter); counter += 5; try { Thread.sleep(smoothMovementPeriod * 1); } catch (InterruptedException ex) { } } registerSpeedSlider.setValue(to); return; } }); inboundBurstRateSliderThread.setName("inboundBurstRateSliderThread"); inboundBurstRateSliderThread.setDaemon(runThreadsAsDaemons); inboundBurstRateSliderThread.start(); Thread inboundRingingResponseDelaySliderThread = new Thread(allThreadsGroup, new Runnable() { @Override public void run() { int counter = 0; int to = inboundRingingResponseDelaySlider.getValue(); while (counter < to) { inboundRingingResponseDelaySlider.setValue(counter); counter += 5000; try { Thread.sleep(smoothMovementPeriod * 2); } catch (InterruptedException ex) { } } inboundRingingResponseDelaySlider.setValue(to); return; } }); inboundRingingResponseDelaySliderThread.setName("inboundRingingResponseDelaySliderThread"); inboundRingingResponseDelaySliderThread.setDaemon(runThreadsAsDaemons); inboundRingingResponseDelaySliderThread.start(); Thread inboundRingingResponseBusyRatioSliderThread = new Thread(allThreadsGroup, new Runnable() { @Override public void run() { int counter = 0; int to = inboundRingingResponseBusyRatioSlider.getValue(); while (counter < to) { inboundRingingResponseBusyRatioSlider.setValue(counter); counter++; try { Thread.sleep(smoothMovementPeriod * 4); } catch (InterruptedException ex) { } } inboundRingingResponseBusyRatioSlider.setValue(to); return; } }); inboundRingingResponseBusyRatioSliderThread.setName("inboundRingingResponseBusyRatioSliderThread"); inboundRingingResponseBusyRatioSliderThread.setDaemon(runThreadsAsDaemons); inboundRingingResponseBusyRatioSliderThread.start(); Thread inboundEndDelaySliderThread = new Thread(allThreadsGroup, new Runnable() { @Override public void run() { int counter = 0; int to = inboundEndDelaySlider.getValue(); while (counter < to) { inboundEndDelaySlider.setValue(counter); counter += 1000; try { Thread.sleep(smoothMovementPeriod); } catch (InterruptedException ex) { } } inboundEndDelaySlider.setValue(to); return; } }); inboundEndDelaySliderThread.setName("inboundEndDelaySliderThread"); inboundEndDelaySliderThread.setDaemon(runThreadsAsDaemons); inboundEndDelaySliderThread.start(); Thread vmUsageThresholdSliderThread = new Thread(allThreadsGroup, new Runnable() { @Override public void run() { int counter = 0; int to = vmUsageThresholdSlider.getValue(); while (counter < to) { vmUsageThresholdSlider.setValue(counter); counter += 5; try { Thread.sleep(smoothMovementPeriod * 1); } catch (InterruptedException ex) { } } vmUsageThresholdSlider.setValue(to); return; } }); vmUsageThresholdSliderThread.setName("vmUsageThresholdSliderThread"); vmUsageThresholdSliderThread.setDaemon(runThreadsAsDaemons); vmUsageThresholdSliderThread.start(); Thread memFreeThresholdSliderThread = new Thread(allThreadsGroup, new Runnable() { @Override public void run() { int counter = 0; int to = memFreeThresholdSlider.getValue(); while (counter < to) { memFreeThresholdSlider.setValue(counter); counter += 1; try { Thread.sleep(smoothMovementPeriod * 1); } catch (InterruptedException ex) { } } memFreeThresholdSlider.setValue(to); return; } }); memFreeThresholdSliderThread.setName("memFreeThresholdSliderThread"); memFreeThresholdSliderThread.setDaemon(runThreadsAsDaemons); memFreeThresholdSliderThread.start(); Thread heapMemFreeThresholdSliderThread = new Thread(allThreadsGroup, new Runnable() { @Override public void run() { int counter = 0; int to = heapMemFreeThresholdSlider.getValue(); while (counter < to) { heapMemFreeThresholdSlider.setValue(counter); counter++; try { Thread.sleep(smoothMovementPeriod * 2); } catch (InterruptedException ex) { } } heapMemFreeThresholdSlider.setValue(to); return; } }); heapMemFreeThresholdSliderThread.setName("heapMemFreeThresholdSliderThread"); heapMemFreeThresholdSliderThread.setDaemon(runThreadsAsDaemons); heapMemFreeThresholdSliderThread.start(); Thread connectingTallyLimitSliderThread = new Thread(allThreadsGroup, new Runnable() { @Override public void run() { int counter = 0; int to = connectingTallyLimitSlider.getValue(); while (counter < to) { connectingTallyLimitSlider.setValue(counter); counter++; try { Thread.sleep(smoothMovementPeriod * 2); } catch (InterruptedException ex) { } } connectingTallyLimitSlider.setValue(to); return; } }); connectingTallyLimitSliderThread.setName("connectingTallyLimitSliderThread"); connectingTallyLimitSliderThread.setDaemon(runThreadsAsDaemons); connectingTallyLimitSliderThread.start(); Thread callingTallyLimitSliderThread = new Thread(allThreadsGroup, new Runnable() { @Override public void run() { int counter = 0; int to = callingTallyLimitSlider.getValue(); while (counter < to) { callingTallyLimitSlider.setValue(counter); counter += 10; try { Thread.sleep(smoothMovementPeriod); } catch (InterruptedException ex) { } } callingTallyLimitSlider.setValue(to); return; } }); callingTallyLimitSliderThread.setName("callingTallyLimitSliderThread"); callingTallyLimitSliderThread.setDaemon(runThreadsAsDaemons); callingTallyLimitSliderThread.start(); Thread establishedTallyLimitSliderThread = new Thread(allThreadsGroup, new Runnable() { @Override public void run() { int counter = 0; int to = establishedTallyLimitSlider.getValue(); while (counter <= to) { establishedTallyLimitSlider.setValue(counter); counter += 2; try { Thread.sleep(smoothMovementPeriod * 2); } catch (InterruptedException ex) { } } establishedTallyLimitSlider.setValue(to); return; } }); establishedTallyLimitSliderThread.setName("establishedTallyLimitSliderThread"); establishedTallyLimitSliderThread.setDaemon(runThreadsAsDaemons); establishedTallyLimitSliderThread.start(); Thread callSpeedSliderThread = new Thread(allThreadsGroup, new Runnable() { @Override public void run() { int counter = 0; int to = callSpeedSlider.getValue(); while (counter <= to) { callSpeedSlider.setValue(counter); counter += 500; try { Thread.sleep(smoothMovementPeriod * 1); } catch (InterruptedException ex) { } } callSpeedSlider.setValue(to); return; } }); callSpeedSliderThread.setName("callSpeedSliderThread"); callSpeedSliderThread.setDaemon(runThreadsAsDaemons); callSpeedSliderThread.start(); }
From source file:ECallCenter21.java
/** * * @throws SQLException//w w w. j a v a 2s . co m * @throws ClassNotFoundException * @throws InstantiationException * @throws IllegalAccessException * @throws NoSuchMethodException * @throws InvocationTargetException * @throws Exception */ @SuppressWarnings({ "static-access", "static-access", "static-access" }) public ECallCenter21() throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, Exception { eCallCenterReference = this; // A thread doesn't inherit local varables, but it does local finals / constants String[] status = new String[2]; // sipstateUpdateThreadPool = Executors.newCachedThreadPool(); // responseUpdateThreadPool = Executors.newCachedThreadPool(); platform = System.getProperty("os.name").toLowerCase(); if (platform.indexOf("windows") != -1) { fileSeparator = "\\"; lineTerminator = "\r\n"; } else { fileSeparator = "/"; lineTerminator = "\r\n"; } plaf = new String[4]; plafSelected = new String(); plaf[0] = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; plaf[1] = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; plaf[2] = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"; plaf[3] = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; setLookAndFeel(PLAF_NIMBUS); setMinimumSize(new Dimension(710, 598)); setMaximumSize(new Dimension(710, 830)); setPreferredSize(getMaximumSize()); setResizable(false); setVisible(false); setVisible(true); initComponents(); Thread defaultConstructorThread = new Thread(allThreadsGroup, new Runnable() { @Override public void run() { String[] status = new String[2]; String imgName = "/images/voipstormboxicon.jpg"; URL imgURL = getClass().getResource(imgName); Image image = Toolkit.getDefaultToolkit().getImage(imgURL); setIconImage(image); setImagePanelVisible(true); initSlidersSmooth(); sysMonitor = new SysMonitor(); dataDir = "data" + fileSeparator; soundsDir = dataDir + "sounds" + fileSeparator; vergunningDir = dataDir + "license" + fileSeparator; databasesDir = dataDir + "databases" + fileSeparator; configDir = dataDir + "config" + fileSeparator; binDir = dataDir + "bin" + fileSeparator; logDir = dataDir + "log" + fileSeparator; currentTimeCalendar = Calendar.getInstance(); logDateString = "" + String.format("%04d", currentTimeCalendar.get(Calendar.YEAR)) + String.format("%02d", currentTimeCalendar.get(Calendar.MONTH) + 1) + String.format("%02d", currentTimeCalendar.get(Calendar.DAY_OF_MONTH)) + "_" + String.format("%02d", currentTimeCalendar.get(Calendar.HOUR_OF_DAY)) + String.format("%02d", currentTimeCalendar.get(Calendar.MINUTE)) + String.format("%02d", currentTimeCalendar.get(Calendar.SECOND)); logFileString = logDir + logDateString + "_" + THISPRODUCT + ".log"; // System.out.println("\r\nChecking Directories..."); showStatus(Vergunning.PRODUCT + "Checking Directories...", true, false); boolean missingDirsDetected = false; boolean missingCriticalDirsDetected = false; file = new File(logDir); if (!file.exists()) { if (new File(logDir).mkdir()) { missingDirsDetected = true; showStatus("Info: Creating missing directory: " + logDir, true, false); } } file = new File(dataDir); if (!file.exists()) { if (new File(dataDir).mkdir()) { missingDirsDetected = true; showStatus("Warning: Creating missing directory: " + dataDir, true, true); } } file = new File(soundsDir); if (!file.exists()) { if (new File(soundsDir).mkdir()) { missingDirsDetected = true; showStatus("Critical: Creating missing directory: " + soundsDir, true, true); missingCriticalDirsDetected = true; } } file = new File(vergunningDir); if (!file.exists()) { if (new File(vergunningDir).mkdir()) { missingDirsDetected = true; showStatus("Info: Creating missing directory: " + vergunningDir, true, true); } } file = new File(databasesDir); if (!file.exists()) { if (new File(databasesDir).mkdir()) { missingDirsDetected = true; showStatus("Info: Creating missing directory: " + databasesDir, true, true); } } file = new File(configDir); if (!file.exists()) { if (new File(configDir).mkdir()) { missingDirsDetected = true; showStatus("Info: Creating missing directory: " + configDir, true, true); } } file = new File(binDir); if (!file.exists()) { if (new File(binDir).mkdir()) { missingDirsDetected = true; showStatus("Critical: Creating missing directory: " + binDir, true, true); missingCriticalDirsDetected = true; } } if (missingCriticalDirsDetected) { showStatus( "Critical directories were missing!!! Please download the entire VoipStorm package at: " + Vergunning.WEBLINK, true, true); try { Thread.sleep(4000); } catch (InterruptedException ex) { } } if (missingDirsDetected) { showStatus("VoipStorm directory structure built", true, true); try { Thread.sleep(1000); } catch (InterruptedException ex) { } } try { weblog = new WebLog(); } catch (Exception ex) { } Thread webLogThread = new Thread(new Runnable() { @Override @SuppressWarnings({ "static-access" }) public void run() { try { weblog.send(THISPRODUCT + " Starting"); } catch (Exception ex) { } } }); webLogThread.setName("webLogThread"); webLogThread.setDaemon(runThreadsAsDaemons); webLogThread.start(); registerSpeedValue.setText(Integer.toString(registrationBurstDelay)); registrationBurstDelay = registerSpeedSlider.getValue(); inboundRingingResponseDelayValue .setText(Integer.toString(inboundRingingResponseDelaySlider.getValue())); inboundRingingResponseBusyRatioValue .setText(Integer.toString(inboundRingingResponseBusyRatioSlider.getValue())); inboundEndDelayValue.setText(Integer.toString(inboundEndDelaySlider.getValue())); vmUsagePauseValue.setText(Integer.toString(vmUsageThresholdSlider.getValue())); vmUsagePauseThreashold = vmUsageThresholdSlider.getValue(); memFreeThresholdValue.setText(Integer.toString(memFreeThresholdSlider.getValue())); memFreeThreshold = memFreeThresholdSlider.getValue(); heapMemFreeThresholdValue.setText(Integer.toString(heapMemFreeThresholdSlider.getValue())); heapMemFreeThreshold = heapMemFreeThresholdSlider.getValue(); connectingTallyLimitValue.setText(Integer.toString(connectingTallyLimitSlider.getValue())); connectingTallyLimit = connectingTallyLimitSlider.getValue(); callingTallyLimitValue.setText(Integer.toString(callingTallyLimitSlider.getValue())); callingTallyLimit = callingTallyLimitSlider.getValue(); establishedTallyLimitValue.setText(Integer.toString(establishedTallyLimitSlider.getValue())); establishedTallyLimit = establishedTallyLimitSlider.getValue(); callSpeedValue.setText(Integer.toString(callSpeedSlider.getValue())); outboundBurstDelay = callSpeedSlider.getValue(); status = new String[2]; status[0] = "0"; status[1] = ""; nlLocale = new Locale("nl"); boundMode = "Outbound"; callCenterStatus = POWEREDOFF; // status = shell.getPID(); if (status[0].equals("0")) // { // pid = Integer.parseInt(status[1]); // outboundCallsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "In/Outbound Campaign Controls " + Integer.toString(pid), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("STHeiti", 0, 14), new java.awt.Color(255, 255, 255))); // NOI18N // } // else { pid = 0; } softphonesQuantity = 0; setTitle(getWindowTitle()); // mainPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, getBrand() + " " + getProduct() + " " + getVersion(), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("STHeiti", 0, 12), new java.awt.Color(102, 102, 102))); // NOI18N // configurationPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Proxy Configuration", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("STHeiti", 0, 12), new java.awt.Color(255, 255, 255))); // NOI18N // Starting the Database Server ultraShortMessagePeriod = 0; smoothMovementPeriod = 40; // eyeBlinkMessagePeriod = 250; // shortMessagePeriod = 1000; mediumMessagePeriod = 2000; myCoordinate = new Coordinate(); brandLabel.setText(Vergunning.BRAND); brandDescriptionLabel.setText(Vergunning.BRAND_DESCRIPTION); productLabel.setText(Vergunning.PRODUCT); productDescriptionLabel.setText(Vergunning.PRODUCT_DESCRIPTION); copyrightLabel.setText(getWarning() + " " + getCopyright() + " " + getBrand() + " " + getBusiness() + " - Author: " + getAuthor()); debugging = false; allThreadsGroup = new ThreadGroup("AllThreads"); vmUsageStatus = new String[2]; memFreeStatus = new String[2]; localDisplayData = new DisplayData(); // localSpeakerData = new SpeakerData(); vmUsageStatus[0] = "0"; vmUsageStatus[1] = ""; memFreeStatus[0] = "0"; memFreeStatus[1] = ""; // inboundSoftPhonesAvailableCounter = 0; inboundInstanceCounter = 0; outboundInstanceCounter = 0; // outboundPowerToggleButton.setEnabled(false); // myClickOnSoundTool = new SoundTool(SoundTool.CLICKONTONE); // myClickOffSoundTool = new SoundTool(SoundTool.CLICKOFFTONE); // mySuccessSoundTool = new SoundTool(SoundTool.SUCCESSTONE); // myPowerSuccessSoundTool = new SoundTool(SoundTool.POWERSUCCESSTONE); // myFailureSoundTool = new SoundTool(SoundTool.FAILURETONE); // myTickSoundTool = new SoundTool(SoundTool.TICKTONE); // myRegisterEnabledSoundTool = new SoundTool(SoundTool.REGISTERENABLEDTONE); // myRegisterDisabledSoundTool = new SoundTool(SoundTool.REGISTERDISABLEDTONE); // myAnswerEnabledSoundTool = new SoundTool(SoundTool.ANSWERENABLEDTONE); // myAnswerDisabledSoundTool = new SoundTool(SoundTool.ANSWERDISABLEDTONE); // myCancelEnabledSoundTool = new SoundTool(SoundTool.CANCELENABLEDTONE); // myCancelDisabledSoundTool = new SoundTool(SoundTool.CANCELDISABLEDTONE); // myMuteEnabledSoundTool = new SoundTool(SoundTool.MUTEENABLEDTONE); // myMuteDisabledSoundTool = new SoundTool(SoundTool.MUTEDISABLEDTONE); // // myRingToneSoundTool = new SoundTool(SoundTool.RINGTONE); // myDialToneSoundTool = new SoundTool(SoundTool.DEADTONE); // myCallToneSoundTool = new SoundTool(SoundTool.CALLTONE); // myBusyToneSoundTool = new SoundTool(SoundTool.BUSYTONE); // myDeadToneSoundTool = new SoundTool(SoundTool.DEADTONE); // myErrorToneSoundTool = new SoundTool(SoundTool.ERRORTONE); configurationCallCenter = new Configuration(); showStatus("Loading CallCenter Configuration...", true, true); /* true = logToApplic, true = logToFile */ status = configurationCallCenter.loadConfiguration("3"); if (status[0].equals("1")) // loadConfig failed { logToApplication("Loading CallCenter Configuration Failed: " + status[1]); showStatus("Loading CallCenter Configuration Failed, creating new Inbound Config", true, true); /* true = logToApplic, true = logToFile */ configurationCallCenter.createConfiguration(); clientIPField.setText(configurationCallCenter.getClientIP()); pubIPField.setText(configurationCallCenter.getPublicIP()); clientPortField.setText(configurationCallCenter.getClientPort()); domainField.setText(configurationCallCenter.getDomain()); serverIPField.setText(configurationCallCenter.getServerIP()); serverPortField.setText(configurationCallCenter.getServerPort()); prefPhoneLinesSlider.setMaximum(vergunning.getPhoneLines()); prefPhoneLinesSlider.setValue(vergunning.getPhoneLines()); usernameField.setText(configurationCallCenter.getUsername()); toegangField.setText(configurationCallCenter.getToegang()); if (configurationCallCenter.getRegister().equals("1")) { registerCheckBox.setSelected(true); } else { registerCheckBox.setSelected(false); } if (configurationCallCenter.getIcons().equals("1")) { iconsCheckBox.setSelected(true); } else { iconsCheckBox.setSelected(false); } showStatus("Saving new CallCenter Configuration...", true, true); /* true = logToApplic, true = logToFile */ configurationCallCenter.saveConfiguration("3"); // myFailureSoundTool.play(); } else // loadConfig Succeeded { // myPowerSuccessSoundTool.play(); clientIPField.setText(configurationCallCenter.getClientIP()); pubIPField.setText(configurationCallCenter.getPublicIP()); clientPortField.setText(configurationCallCenter.getClientPort()); domainField.setText(configurationCallCenter.getDomain()); serverIPField.setText(configurationCallCenter.getServerIP()); serverPortField.setText(configurationCallCenter.getServerPort()); prefPhoneLinesSlider.setMaximum(Integer.parseInt(configurationCallCenter.getPrefPhoneLines())); prefPhoneLinesSlider.setValue(Integer.parseInt(configurationCallCenter.getPrefPhoneLines())); usernameField.setText(configurationCallCenter.getUsername()); toegangField.setText(configurationCallCenter.getToegang()); if (configurationCallCenter.getRegister().equals("1")) { registerCheckBox.setSelected(true); } else { registerCheckBox.setSelected(false); } if (configurationCallCenter.getIcons().equals("1")) { iconsCheckBox.setSelected(true); } else { iconsCheckBox.setSelected(false); } showStatus("CallCenter Configuration Loaded Successfully", true, true); /* true = logToApplic, true = logToFile */ } icons = new Icons(PHONESPOOLTABLECOLUMNWIDTH, PHONESPOOLTABLECOLUMNHEIGHT, iconsCheckBox.isSelected()); lastTimeDashboardCalendar = Calendar.getInstance(); currentTimeDashboardCalendar = Calendar.getInstance(); // Prevent nullpointer in dashboard timer updateSystemStatsTimer = new Timer(); updateSystemStatsTimer.scheduleAtFixedRate(new UpdateSystemStatsTimer(eCallCenterReference), (long) (0), updateSystemStatsTimerFastInterval); showStatus( "updateSystemStatsTimer Scheduled immediate at " + Math.round(updateSystemStatsTimerFastInterval / 1000) + " Sec Interval", true, true); /* true = logToApplic, true = logToFile */ updateStallerTimer = new Timer(); updateStallerTimer.scheduleAtFixedRate(new UpdateStallerDetectorTimer(eCallCenterReference), (long) (0), updateStallerTimerInterval); showStatus( "updateStallerTimer Scheduled immediate at " + Math.round(updateStallerTimerInterval / 1000) + " Sec Interval", true, true); /* true = logToApplic, true = logToFile */ updateVergunningTimer = new Timer(); updateVergunningTimer.scheduleAtFixedRate(new UpdateVergunningTimer(eCallCenterReference), (long) (0), updateVergunningTimerInterval); showStatus( "updateLicenseTimer Scheduled immediate at " + Math.round(updateVergunningTimerInterval / 1000) + " Sec Interval", true, true); /* true = logToApplic, true = logToFile */ updateDashboardTimer = new Timer(); updateDashboardTimer.scheduleAtFixedRate(new UpdateDashboardTimer(eCallCenterReference), (long) (0), updateDashboardTimerInterval); showStatus( "updateDashboardTimer Scheduled immediate at " + Math.round(updateDashboardTimerInterval / 1000) + " Sec Interval", true, true); /* true = logToApplic, true = logToFile */ updateAutoSpeedTimer = new Timer(); updateAutoSpeedTimer.scheduleAtFixedRate(new UpdateAutoSpeedTimer(eCallCenterReference), (long) (0), updateAutoSpeedTimerInterval); showStatus( "updateAutoSpeedTimer Scheduled immediate at " + Math.round(updateAutoSpeedTimerInterval / 1000) + " Sec Interval", true, true); /* true = logToApplic, true = logToFile */ shell = new Shell(); platform = shell.getPlatform().toLowerCase(); if (platform.indexOf("mac os x") != -1) { systemStatsTable.setValueAt("RealMemFree", 2, 0); } else if (platform.indexOf("linux") != -1) { systemStatsTable.setValueAt("TotMemFree", 2, 0); } //phonesPoolTable.setFont(new java.awt.Font("STHeiti", 0, 12)); else if (platform.indexOf("sunos") != -1) { systemStatsTable.setValueAt("TotMemFree", 2, 0); } else if (platform.indexOf("hpux") != -1) { systemStatsTable.setValueAt("TotMemFree", 2, 0); } else if (platform.indexOf("aix") != -1) { systemStatsTable.setValueAt("TotMemFree", 2, 0); } else if (platform.indexOf("bsd") != -1) { systemStatsTable.setValueAt("TotMemFree", 2, 0); } else if (platform.indexOf("windows") != -1) { systemStatsTable.setValueAt("TotMemFree", 2, 0); } else { systemStatsTable.setValueAt(platform + "?", 2, 0); setAutoSpeed(false); } // if (snmpCheckBox.isSelected()) // { // mySNMP = new SNMPClient(); // showStatus("Checking your SNMP server...", true, true); status = mySNMP.getStat(mySNMP.CPUIDLEOID); // if (status[0].equals("1")) { showStatus("Is your SNMP server running?", true, true); System.exit(1);} // // // Setup the infrequent SystemStats Timer // updateSystemStatsTimer.cancel(); updateSystemStatsTimer.purge(); // showStatus("updateSystemStatsTimer Canceled!", true, true); /* true = logToApplic, true = logToFile */ // updateSystemStatsTimer = new Timer(); updateSystemStatsTimer.scheduleAtFixedRate(new UpdateSystemStatsTimer(this), (long)(0), (updateSystemStatsTimerFastInterval)); // showStatus("updateSystemStatsTimer Scheduled immediate at " + Math.round(updateSystemStatsTimerFastInterval / 1000) + " Sec Interval", true, true); /* true = logToApplic, true = logToFile */ // } // captionTable.setValueAt(onSymbol + " ON", 0, 0); // captionTable.setValueAt("IDL/REG", 0, 1); // captionTable.setValueAt(connectingSymbol + " CON", 0, 2); // captionTable.setValueAt(callingSymbol + " CLL", 0, 3); // captionTable.setValueAt(ringingSymbol + " RNG", 0, 4); // captionTable.setValueAt(acceptingSymbol + " ACC", 0, 5); // captionTable.setValueAt(talkingSymbol + " TLK" , 0, 6); // captionTable.setValueAt(localcancelSymbol + " CAN", 0, 7); // captionTable.setValueAt(localbusySymbol + " BSY", 0, 8); // captionTable.setValueAt(localbyeSymbol + " " + remotebyeSymbol + " BYE", 0, 9); captionTable.setValueAt("ON", 0, 0); captionTable.setValueAt("IDL/REG", 0, 1); captionTable.setValueAt("CON", 0, 2); captionTable.setValueAt("TRY", 0, 3); captionTable.setValueAt("CLL", 0, 4); captionTable.setValueAt("RNG", 0, 5); captionTable.setValueAt("ACC", 0, 6); captionTable.setValueAt("TLK", 0, 7); captionTable.setValueAt("CAN", 0, 8); captionTable.setValueAt("BSY", 0, 9); captionTable.setValueAt("BYE", 0, 10); // Set the CallRatio Pie Chart callRatioChartData = new DefaultPieDataset(); // callRatioChartData.setValue("Slack", 0); callRatioChartData.setValue("Busy", 0); callRatioChartData.setValue("Success", 0); callRatioChart = ChartFactory.createPieChart("Waiting for Campaign...", callRatioChartData, true, true, false); // legend? // tooltips? // URLs? chartPanel = new ChartPanel(callRatioChart); org.jdesktop.layout.GroupLayout graphInnerPanelLayout = new org.jdesktop.layout.GroupLayout( graphInnerPanel); graphInnerPanel.setLayout(graphInnerPanelLayout); graphInnerPanelLayout.setHorizontalGroup( graphInnerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add( chartPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 706, Short.MAX_VALUE)); graphInnerPanelLayout.setVerticalGroup( graphInnerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add( chartPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 247, Short.MAX_VALUE)); chartPanel.setFont(new java.awt.Font("STHeiti", 0, 10)); // NOI18N graphInnerPanel.setVisible(false); chartPanel.setVisible(false); chartPanel.setDoubleBuffered(true); // Set the PerformanceMeter Dial performanceMeter = new PerformanceMeter("Performance", vmUsageDecelerationThreashold, (Vergunning.CALLSPERHOUR_ENTERPRISE / 100)); performanceChartPanel = new ChartPanel(performanceMeter.chart1); org.jdesktop.layout.GroupLayout graphInnerPanelLayout2 = new org.jdesktop.layout.GroupLayout( performanceMeterPanel); performanceMeterPanel.setLayout(graphInnerPanelLayout2); graphInnerPanelLayout2.setHorizontalGroup( graphInnerPanelLayout2.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add( performanceChartPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, performanceDialSize, Short.MAX_VALUE)); graphInnerPanelLayout2.setVerticalGroup( graphInnerPanelLayout2.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add( performanceChartPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, performanceDialSize, Short.MAX_VALUE)); performanceChartPanel.setFont(new java.awt.Font("STHeiti", 0, 10)); // NOI18N performanceMeterPanel.setVisible(true); performanceChartPanel.setVisible(true); performanceMeter.setCallPerHourNeedle(0); destination = new Destination(); // destinationElement = new Destination(); campaignStat = new CampaignStat(); lastStallerCampaignStat = new CampaignStat(); lastTimeDashboardCampaignStat = new CampaignStat(); // Last but not least, loading the Database Client try { dbClient = new JavaDBClient(eCallCenterReference, DATABASE); } catch (SQLException ex) { } catch (ClassNotFoundException ex) { } catch (InstantiationException ex) { } catch (IllegalAccessException ex) { } catch (NoSuchMethodException ex) { } catch (InvocationTargetException ex) { } catch (Exception ex) { } // Check for Open Campaigns String[] openCampaigns = dbClient.getOpenCampaigns(); if ((openCampaigns != null) && (openCampaigns.length > 0)) { campaignComboBox.setModel(new javax.swing.DefaultComboBoxModel(openCampaigns)); campaignComboBox.setEnabled(true); } else { campaignComboBox.setEnabled(false); runCampaignToggleButton.setEnabled(false); stopCampaignButton.setEnabled(false); } callCenterIsNetManaged = false; vergunningStartCalendar = Calendar.getInstance(); vergunningEndCalendar = Calendar.getInstance(); vergunningStartCalendar.set(Calendar.HOUR_OF_DAY, (int) 0); vergunningStartCalendar.set(Calendar.MINUTE, (int) 0); vergunningStartCalendar.set(Calendar.SECOND, (int) 0); vergunning = new Vergunning(); executeVergunning(); if (!vergunning.isValid()) { vergunningCodeField.setText(""); } else { performanceMeter.setCallPerHourScale(0, (vergunning.getCallsPerHour() / 100), (vergunning.getCallsPerHour() / 1000)); } timeTool = new TimeTool(); defaultConstructorIsReady = true; } }); defaultConstructorThread.setName("defaultConstructorThread"); defaultConstructorThread.setDaemon(runThreadsAsDaemons); defaultConstructorThread.setPriority(5); defaultConstructorThread.start(); }