/hazelcast/src/main/java/com/hazelcast/core/MapLoaderLifecycleSupport.java

https://bitbucket.org/gabral6_gmailcom/hazelcast · Java · 50 lines · 6 code · 4 blank · 40 comment · 0 complexity · b4303b408f5e70e1ad4615e72b317ca9 MD5 · raw file

  1. /*
  2. * Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.hazelcast.core;
  17. import java.util.Properties;
  18. /**
  19. * Provides Lifecycle support for the implementing MapLoader class.
  20. * MapLoader classes implementing MapLoaderLifecycleSupport
  21. * interface will be called by Hazelcast on init and destroy so that
  22. * implementation can do necessary configuration when initializing and
  23. * cleanup when destroying.
  24. */
  25. public interface MapLoaderLifecycleSupport {
  26. /**
  27. * Initializes this MapLoader implementation. Hazelcast will call
  28. * this method when the map is first used on the
  29. * HazelcastInstance. Implementation can
  30. * initialize required resources for the implementing
  31. * mapLoader such as reading a config file and/or creating
  32. * database connection.
  33. *
  34. * @param hazelcastInstance HazelcastInstance of this mapLoader.
  35. * @param properties Properties set for this mapStore. see MapStoreConfig
  36. * @param mapName name of the map.
  37. */
  38. void init(HazelcastInstance hazelcastInstance, Properties properties, String mapName);
  39. /**
  40. * Hazelcast will call this method before shutting down.
  41. * This method can be overridden to cleanup the resources
  42. * held by this map loader implementation, such as closing the
  43. * database connections etc.
  44. */
  45. void destroy();
  46. }