Advertisement
Guest User

Untitled

a guest
Jun 27th, 2011
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. /*
  2. * Copyright 2009 Dukascopy® (Suisse) SA. All rights reserved.
  3. * DUKASCOPY PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  4. */
  5. package com.dukascopy.api.system;
  6.  
  7. /**
  8. * Factory to create IClient instance
  9. *
  10. * @author Dmitry Shohov
  11. */
  12. public class ClientFactory {
  13. private static IClient client;
  14.  
  15. /**
  16. * Returns default instance of Dukascopy IClient. Instance is created only once, each call will return the same instance
  17. *
  18. * @return instance of IClient
  19. * @throws ClassNotFoundException if jar file with implementation was not found
  20. * @throws IllegalAccessException if there is some security problems
  21. * @throws InstantiationException if it's not possible to instantiate new instance of Dukascopy IClient
  22. */
  23. public static IClient getDefaultInstance() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
  24. synchronized (ClientFactory.class) {
  25. if (client == null) {
  26. Class dcClientImpl = Thread.currentThread().getContextClassLoader().loadClass("com.dukascopy.api.impl.connect.DCClientImpl");
  27. client = (IClient) dcClientImpl.newInstance();
  28. }
  29. return client;
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement