You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Main.java 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.threading;
  19. import java.io.BufferedReader;
  20. import java.io.File;
  21. import java.io.IOException;
  22. import org.apache.fop.activity.ContainerUtil;
  23. import org.apache.fop.configuration.Configuration;
  24. import org.apache.fop.configuration.DefaultConfigurationBuilder;
  25. /**
  26. * Starter class for the multi-threading testbed.
  27. */
  28. public final class Main {
  29. private Main() {
  30. }
  31. private static void prompt() throws IOException {
  32. BufferedReader in = new BufferedReader(new java.io.InputStreamReader(System.in));
  33. System.out.print("Press return to continue...");
  34. in.readLine();
  35. }
  36. /**
  37. * Main method.
  38. * @param args the command-line arguments
  39. */
  40. public static void main(String[] args) {
  41. try {
  42. //Read configuration
  43. File cfgFile = new File(args[0]);
  44. DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
  45. Configuration cfg = builder.buildFromFile(cfgFile);
  46. boolean doPrompt = cfg.getAttributeAsBoolean("prompt", false);
  47. if (doPrompt) {
  48. prompt();
  49. }
  50. //Setup testbed
  51. FOPTestbed testbed = new FOPTestbed();
  52. // ContainerUtil.enableLogging(testbed, new ConsoleLogger(ConsoleLogger.LEVEL_INFO));
  53. ContainerUtil.configure(testbed, cfg);
  54. ContainerUtil.initialize(testbed);
  55. //Start tests
  56. testbed.doStressTest();
  57. System.exit(0);
  58. } catch (Exception e) {
  59. // System.err.println(ExceptionUtil.printStackTrace(e));
  60. e.printStackTrace(System.err);
  61. System.exit(-1);
  62. }
  63. }
  64. }