BoxSDKService { public BoxFolder createFolder(String folderName, String parentId) throws BoxSDKServiceException { try { BoxFolder parentFolder = new BoxFolder(getBoxAPIConnection(), parentId); BoxFolder.Info createFolderInfo = parentFolder.createFolder(folderName); logger.debug("created: " + createFolderInfo.getID() + ", name: " + createFolderInfo.getName()); return createFolderInfo.getResource(); } catch (BoxAPIException e) { throw new BoxSDKServiceException("Can't create folder: " + folderName, e); } }  BoxSDKServiceConfig getBoxSDKServiceConfig(); BoxAPIConnection getBoxAPIConnection(); BoxFolder getRootFolder(); BoxFolder createSharedFolder(String folderName); BoxFolder createSharedFolder(String folderName, String parentId); BoxFolder createFolderUnderRoot(String folderName); BoxFolder createFolder(String folderName, String parentId); BoxFile uploadFile(String folderId, String filename, String filecontent); List<BoxFile> listFiles(String folderId); BoxFileWithContent getFileContent(BoxFile file); String getFileContent(String fileId); String getBoxEmbedWidgetIFrame(BoxFolder boxFolder); BoxFolder getFolderWithName(String folderName); BoxFolder getFolderWithNameAndParentFolderId(String folderName, String parentFolderId); void deleteFolderAndItsContent(String folderId); void deleteFolderContentOlderThan(String folderId, DateTime olderThan); void addCommentToFile(String fileId, String comment);  }
@Test @Category(BoxSDKTest.class) public void testMultithreadedCreateFolder() throws ExecutionException, InterruptedException { int nbThreads = 10; ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(nbThreads); List<Callable<Object>> callables = new ArrayList<>(); for (int i = 0; i < nbThreads; i++) { callables.add(new Callable() { @Override public Object call() throws Exception { boxSDKService.createFolder("testMultithreadedCreateFolder-" + UUID.randomUUID(), testFolder.getID()); return null; } }); } List<Future<Object>> invokeAll = newFixedThreadPool.invokeAll(callables); for (Future<Object> future : invokeAll) { try { future.get(); } catch (ExecutionException e) { fail("Multithreaded create folder must not fail: " + e.getMessage()); } } }