This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Default method in implementation class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"subcat": [{ | |
"prod_type": [{ | |
"name": "Bouquets & Bunches", | |
"attr": ["Size_2165_fa", "Type-of-Flowers_2166_fa", "Colour-of-Flower_2168_fa", "Type-of-Base_2169_fa"] | |
}, { | |
"name": "Basket Arrangements", | |
"attr": ["Size_2170_fa", "Type-of-Flowers_2171_fa", "Type-of-Arrangement_2172_fa", "Colour-of-Flower_2173_fa"] | |
}], | |
"name": "Flowers" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StaticTest { | |
static int i; | |
static { | |
System.out.println("Static Initialization block is called"); | |
i = 10; | |
} | |
StaticTest() { | |
System.out.println("Static Test Constructor is called"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Static Initialization block is called | |
10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class InitializerTest { | |
int i; | |
{ | |
System.out.println("Instance Initialization block is called"); | |
i = 5; | |
} | |
InitializerTest() { | |
System.out.println("Initializer Test Default Constructor is called"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instance Initialization block is called | |
Initializer Test Default Constructor is called | |
5 | |
Instance Initialization block is called | |
Initializer Test Parametrized Constructor is called | |
10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static CuratorFramework createConnection(String zookeeperConnectionString) { | |
//First retry will wait for 1 second, | |
//the second will wait up to 2 seconds, | |
//the third will wait upto 4 seconds. | |
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3); | |
CuratorFramework client = CuratorFrameworkFactory.builder() | |
.connectString(zookeeperConnectionString) | |
.retryPolicy(retryPolicy) | |
.namespace("session_service") | |
.canBeReadOnly(true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void create(CuratorFramework client, String path) throws Exception { | |
client.create().forPath(path); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void setData(CuratorFramework client, String path, String data) throws Exception { | |
byte[] payload = data.getBytes(); | |
client.setData() | |
.forPath(path, payload); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void delete(CuratorFramework client, String path) throws Exception { | |
client.delete() | |
.forPath(path); | |
} |