/** * 响应:员工的在线状态 * * <p>一次请求最大值为100 * * @param command */ private void responseState(short command) { LogFactory.d("EmployeeState", "----------responseEmployeeState ---------"); GetEmployeesStatusInPacket inPacket = (GetEmployeesStatusInPacket) IMOApp.getDataEngine().getInPacketByCommand(command); if (inPacket == null) { return; } inPacket.getCid(); int[] uid = inPacket.getUid(); int[] status = inPacket.getStatus(); for (int i = 0; i < uid.length; i++) { mGlobal.userStateMap.put(uid[i], status[i]); } // 当前部门的请求是否都已经完成了 if (parent_hasRequestCount < parent_StateRequestCount) { Object[] idArrays = getRequestUserIdArray(); if (idArrays != null) { doEmployeeState(((int[]) idArrays[0]).length, ((int[]) idArrays[0]), ((int[]) idArrays[1])); } } else { LogFactory.d("EmployeeState", "状态请求完成。。。。。"); // /更新 StateHandle.getInstance().updateAllState(); } }
@Test public void testSerializableState() { File tempDir = new File(ConfigConstants.DEFAULT_TASK_MANAGER_TMP_PATH, UUID.randomUUID().toString()); try { FsStateBackend backend = CommonTestUtils.createCopySerializable(new FsStateBackend(localFileUri(tempDir))); backend.initializeForJob( new DummyEnvironment("test", 1, 0), "test-op", IntSerializer.INSTANCE); File checkpointDir = new File(backend.getCheckpointDirectory().toUri().getPath()); String state1 = "dummy state"; String state2 = "row row row your boat"; Integer state3 = 42; StateHandle<String> handle1 = backend.checkpointStateSerializable(state1, 439568923746L, System.currentTimeMillis()); StateHandle<String> handle2 = backend.checkpointStateSerializable(state2, 439568923746L, System.currentTimeMillis()); StateHandle<Integer> handle3 = backend.checkpointStateSerializable(state3, 439568923746L, System.currentTimeMillis()); assertEquals(state1, handle1.getState(getClass().getClassLoader())); handle1.discardState(); assertEquals(state2, handle2.getState(getClass().getClassLoader())); handle2.discardState(); assertEquals(state3, handle3.getState(getClass().getClassLoader())); handle3.discardState(); assertTrue(isDirectoryEmpty(checkpointDir)); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } finally { deleteDirectorySilently(tempDir); } }