Commit 0b9c3a4b authored by abdullh.alsoleman's avatar abdullh.alsoleman

First_Commit

parent 0e7491ac
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
\ No newline at end of file
<component name="ArtifactManager">
<artifact type="jar" name="Cordinator_Worker:jar">
<output-path>$PROJECT_DIR$/out/artifacts/Cordinator_Worker_jar</output-path>
<root id="archive" name="Cordinator_Worker.jar">
<element id="module-output" name="Cordinator_Worker" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/netty/netty-transport-classes-epoll/4.1.94.Final/netty-transport-classes-epoll-4.1.94.Final.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/netty/netty-tcnative-boringssl-static/2.0.61.Final/netty-tcnative-boringssl-static-2.0.61.Final.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/netty/netty-tcnative-boringssl-static/2.0.61.Final/netty-tcnative-boringssl-static-2.0.61.Final-osx-aarch_64.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/yetus/audience-annotations/0.12.0/audience-annotations-0.12.0.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/netty/netty-transport-native-unix-common/4.1.94.Final/netty-transport-native-unix-common-4.1.94.Final.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/netty/netty-tcnative-boringssl-static/2.0.61.Final/netty-tcnative-boringssl-static-2.0.61.Final-linux-aarch_64.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/netty/netty-common/4.1.94.Final/netty-common-4.1.94.Final.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/netty/netty-transport-native-epoll/4.1.94.Final/netty-transport-native-epoll-4.1.94.Final-linux-x86_64.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/netty/netty-resolver/4.1.94.Final/netty-resolver-4.1.94.Final.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/netty/netty-buffer/4.1.94.Final/netty-buffer-4.1.94.Final.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/netty/netty-codec/4.1.94.Final/netty-codec-4.1.94.Final.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/netty/netty-handler/4.1.94.Final/netty-handler-4.1.94.Final.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/ch/qos/logback/logback-core/1.2.10/logback-core-1.2.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/zookeeper/zookeeper-jute/3.9.1/zookeeper-jute-3.9.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/netty/netty-tcnative-classes/2.0.61.Final/netty-tcnative-classes-2.0.61.Final.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/netty/netty-tcnative-boringssl-static/2.0.61.Final/netty-tcnative-boringssl-static-2.0.61.Final-osx-x86_64.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/apache/zookeeper/zookeeper/3.9.1/zookeeper-3.9.1.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/netty/netty-tcnative-boringssl-static/2.0.61.Final/netty-tcnative-boringssl-static-2.0.61.Final-windows-x86_64.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/netty/netty-transport/4.1.94.Final/netty-transport-4.1.94.Final.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/ch/qos/logback/logback-classic/1.2.10/logback-classic-1.2.10.jar" path-in-jar="/" />
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/netty/netty-tcnative-boringssl-static/2.0.61.Final/netty-tcnative-boringssl-static-2.0.61.Final-linux-x86_64.jar" path-in-jar="/" />
</root>
</artifact>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17 (2)" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ArtifactsWorkspaceSettings">
<artifacts-to-build>
<artifact name="Cordinator_Worker:jar" />
</artifacts-to-build>
</component>
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="589614c7-b849-4bb8-ae3e-07f54c8871b6" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/artifacts/Cordinator_Worker_jar.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/Application.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/Coordinator_Worker/Communication.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/Coordinator_Worker/Coordinator.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/Coordinator_Worker/DataObject.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/Coordinator_Worker/Document.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/Coordinator_Worker/Term.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/Coordinator_Worker/Worker.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/Zookeeper/LeaderElection.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/Zookeeper/OnElectionAction.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/Zookeeper/OnElectionCallback.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/Zookeeper/ServiceRegistry.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/file1.txt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/file2.txt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/file3.txt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/file4.txt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/file5.txt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/logback.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectId" id="2bAGyJ84QDiRIUvnsCkECWwzYqo" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"last_opened_file_path": "C:/Users/Abdullah/Downloads/network-communication-master/Cordinator_Worker/src/main/resources",
"project.structure.last.edited": "Artifacts",
"project.structure.proportion": "0.0",
"project.structure.side.proportion": "0.0"
}
}]]></component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\Abdullah\Downloads\network-communication-master\Cordinator_Worker\src\main\resources" />
<recent name="C:\Users\Abdullah\Downloads\network-communication-master\Cordinator_Worker\src\main\java" />
<recent name="C:\Users\Abdullah\Downloads\network-communication-master\Cordinator_Worker\src\main\java\Zookeeper" />
</key>
<key name="MoveClassesOrPackagesDialog.RECENTS_KEY">
<recent name="" />
</key>
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="" />
</key>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="589614c7-b849-4bb8-ae3e-07f54c8871b6" name="Changes" comment="" />
<created>1705650743099</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1705650743099</updated>
</task>
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/Coordinator_Worker/Worker.java</url>
<line>40</line>
<option name="timeStamp" value="9" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/java/Coordinator_Worker/Coordinator.java</url>
<line>85</line>
<option name="timeStamp" value="12" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project>
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>Service-Registration-and-Discovery</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.9.1</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
import Zookeeper.LeaderElection;
import Zookeeper.OnElectionAction;
import Zookeeper.ServiceRegistry;
import ch.qos.logback.classic.Logger;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
import org.slf4j.LoggerFactory;
import java.io.IOException;
public class Application implements Watcher {
private static final Logger logger = (Logger) LoggerFactory.getLogger(Application.class);
private static final String address = "192.168.56.115:2181";
private static final int SESSION_TIMEOUT = 3000; //dead client
private static final int DEFAULT_PORT = 8080;
private ZooKeeper zooKeeper;
public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
// if (args.length != 3) {
// logger.error("Expecting parameters <port number> <number of workers> <path to worker jar file>");
// System.exit(1);
// }
int currentServerPort = args.length == 1 ? Integer.parseInt(args[0]) : DEFAULT_PORT;
Application application = new Application();
ZooKeeper zooKeeper = application.connectToZookeeper();
// int numberOfWorkers = Integer.parseInt(args[1]);
//String pathToWorkerProgram = args[2];
//Autohealer autohealer = new Autohealer(numberOfWorkers, pathToWorkerProgram,zooKeeper);
//ServiceRegistry serviceRegistry = new ServiceRegistry(zooKeeper,autohealer);
ServiceRegistry serviceRegistry = new ServiceRegistry(zooKeeper);
OnElectionAction onElectionAction = new OnElectionAction(serviceRegistry, currentServerPort);
LeaderElection leaderElection = new LeaderElection(zooKeeper, onElectionAction);
leaderElection.volunteerForLeadership();
leaderElection.reelectLeader();
application.run();
application.close();
}
public ZooKeeper connectToZookeeper() throws IOException {
this.zooKeeper = new ZooKeeper(address, SESSION_TIMEOUT, this);
return zooKeeper;
}
public void run() throws InterruptedException {
synchronized (zooKeeper) {
zooKeeper.wait();
}
}
private void close() throws InterruptedException {
this.zooKeeper.close();
}
@Override
public void process(WatchedEvent watchedEvent) {
switch (watchedEvent.getType()) {
case None:
if (watchedEvent.getState() == Event.KeeperState.SyncConnected) {
logger.info("Successfully connected to Zookeeper");
} else if (watchedEvent.getState() == Event.KeeperState.Disconnected) {
synchronized (zooKeeper) {
logger.error("Disconnected from Zookeeper");
zooKeeper.notifyAll();
}
} else if (watchedEvent.getState() == Event.KeeperState.Closed) {
logger.error ("Closed Successfully");
}
break;
}
}
}
package Coordinator_Worker;
import java.io.*;
import java.net.Socket;
import java.util.List;
import java.util.Map;
public class Communication {
public static void sendData(Socket socket, String dataString, List<String> fileNames) throws IOException {
ObjectOutputStream objectOutputStream = new ObjectOutputStream(socket.getOutputStream());
objectOutputStream.writeObject(new DataObject(dataString, fileNames));
}
public static List<Document> receiveResult(Socket socket) throws IOException, ClassNotFoundException {
ObjectInputStream objectInputStream = new ObjectInputStream(socket.getInputStream());
return (List<Document>) objectInputStream.readObject();
}
public static DataObject receiveData(Socket socket) throws IOException, ClassNotFoundException {
ObjectInputStream objectInputStream = new ObjectInputStream(socket.getInputStream());
return (DataObject) objectInputStream.readObject();
}
public static void sendResult(Socket socket, List<Document> response) throws IOException {
ObjectOutputStream objectOutputStream = new ObjectOutputStream(socket.getOutputStream());
objectOutputStream.writeObject(response);
}
}
package Coordinator_Worker;
import Zookeeper.ServiceRegistry;
import java.io.IOException;
import java.net.Socket;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.concurrent.*;
public class Coordinator {
private static final int PORT = 4444;
public static void startCoordinator() {
try {
List<Future<List<Document>>> futures = new ArrayList<>();
List<Document> resultFromAllWorkers=new ArrayList<>();
String dataString = "the car";
String [] parts = dataString.split("\\s");
List<Term> terms = new ArrayList<>();
for (String part:parts) {
terms.add(new Term(part));
}
TreeMap<String,Double> response= new TreeMap<>();
List<String> fileNames = getFileNamesInDirectory("src/main/resources");
int eachWorkerFiles = fileNames.size() / ServiceRegistry.getWorkers().size();
int mode = fileNames.size() % ServiceRegistry.getWorkers().size();
int index = 0;
List<CoordinatorHandler> handlerList = new ArrayList<>();
ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
if(ServiceRegistry.getWorkers().size()==1){
// Connect to worker
Socket workerSocket = new Socket("127.0.0.1", PORT);
// Create a CoordinatorHandler instance for each worker
CoordinatorHandler handler = new CoordinatorHandler(dataString,workerSocket, fileNames);
handlerList.add(handler);
// Start the CoordinatorHandler thread
futures.add(executorService.submit(handler));
}else {
for (Worker worker : ServiceRegistry.getWorkers()) {
List<String> workerFilesList = new ArrayList<>();
for (int i = 0; i < eachWorkerFiles; i++) {
workerFilesList.add(fileNames.get(index));
index++;
if (mode != 0) {
if (index != fileNames.size()) {
workerFilesList.add(fileNames.get(index));
index++;
}
}
// Connect to worker
Socket workerSocket = new Socket("127.0.0.1", PORT);
// Create a CoordinatorHandler instance for each worker
CoordinatorHandler handler = new CoordinatorHandler(dataString, workerSocket, workerFilesList);
handlerList.add(handler);
// Start the CoordinatorHandler thread
futures.add(executorService.submit(handler));
}
}
}
for (Future<List<Document>> future : futures) {
try {
List<Document> documents = future.get();
resultFromAllWorkers.addAll(documents);
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
executorService.awaitTermination(5,TimeUnit.MICROSECONDS);
// Shut down the executor after all tasks are submitted
executorService.shutdown();
for (int i=0 ; i<terms.size();i++) {
for (Document document:resultFromAllWorkers) {
Map<String,Double> tf = document.getTf();
if(tf.get(terms.get(i))>0);
terms.get(i).increase();
}
}
TreeMap<String,Double> IDF = new TreeMap<>();
for (Document document: resultFromAllWorkers) {
document.setTerms(terms);
document.CalculateIDF(fileNames.size());
IDF.put(document.getName(),document.getIDF());
}
System.out.println("IDF Files: "+ IDF);
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
public static List<String> getFileNamesInDirectory(String directoryPath) {
try {
// Create a Path object for the specified directory
Path directory = Paths.get(directoryPath);
// Use try-with-resources to open a DirectoryStream and iterate over the files
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(directory)) {
// Create a list to store file names
List<String> fileNames = new ArrayList<>();
// Iterate over the files in the directory
for (Path path : directoryStream) {
// Get the file name and add it to the list
fileNames.add(path.getFileName().toString());
}
// Return the list of file names
return fileNames;
}
} catch (IOException e) {
// Handle exceptions, e.g., directory not found
e.printStackTrace();
return Collections.emptyList();
}
}
static class CoordinatorHandler implements Callable<List<Document>> {
private Socket clientSocket;
private List<String> fileNames = new ArrayList<>();
// private List<Document> result = new ArrayList<>();
String dataString= "";
public CoordinatorHandler(String dataString,Socket socket, List<String> fileNames) {
this.clientSocket = socket;
this.fileNames.addAll(fileNames);
this.dataString=dataString;
}
@Override
public List<Document> call() {
List<Document> result=new ArrayList<>();
try {
// Assume the coordinator sends a string and a list of file names
// Send data to worker
Communication.sendData(clientSocket, dataString, fileNames);
// Receive results from worker
result = Communication.receiveResult(clientSocket);
System.out.println("Received result from worker: " + result);
clientSocket.close();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} finally {
return result;
}
}
// public List<Document> getResult() {
// return result;
// }
}
}
package Coordinator_Worker;
import java.io.Serializable;
import java.util.List;
class DataObject implements Serializable {
private String dataString;
private List<String> fileNames;
public DataObject(String dataString, List<String> fileNames) {
this.dataString = dataString;
this.fileNames = fileNames;
}
public String getDataString() {
return dataString;
}
public List<String> getFileNames() {
return fileNames;
}
}
package Coordinator_Worker;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Document implements Serializable {
private String name;
private Map<String,Double> tf;
private List<Term> terms;
private Double IDF=0.0;
public Document(String name)
{
this.name = name;
}
public String getName() {
return name;
}
public Map<String, Double> getTf() {
return tf;
}
public void setTerms(List<Term> terms) {
this.terms.addAll(terms);
}
public void setTf(String fileName, Double value ) {
this.tf.put(fileName,value);
}
public Double getIDF() {
return IDF;
}
public void CalculateIDF(int totalNumFiles){
for(int i=0; i < terms.size();i++) {
Term term = terms.get(i);
IDF += Math.log(term.getNumOfFile() / totalNumFiles) * tf.get(term.getTermName());
}
}
}
package Coordinator_Worker;
public class Term {
private String term;
private double numOfFile;
public Term(String term) {
this.term = term;
}
public double getNumOfFile() {
return numOfFile;
}
public String getTermName() {
return term;
}
public void increase(){
numOfFile++;
}
}
package Coordinator_Worker;
import java.io.File;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.*;
public class Worker {
private static final int PORT = 4444;
private String nodeName;
private String ipAddress;
private String userName;
private static List<Document> documents = new ArrayList<>();
public Worker(String fullPathNode) {
this.nodeName = fullPathNode;
}
public static void startWorker() {
// Step 1: Set up server socket to listen for connections
while (true) {
try {
ServerSocket serverSocket = new ServerSocket(PORT);
// Step 2: Accept connection from coordinator
Socket coordinatorSocket = serverSocket.accept();
// Step 3: Receive data from coordinator
DataObject data = Communication.receiveData(coordinatorSocket);
System.out.println("Received data from coordinator: " + data.getDataString() + ", " + data.getFileNames());
// Step 4: Process the data using IDF algorithm
List<Document> response = IDF(data);
// Step 5: Send the result back to the coordinator
Communication.sendResult(coordinatorSocket, response);
// Step 6: Close sockets
coordinatorSocket.close();
serverSocket.close();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
}
// Function to calculate IDF for each term in the search query across files
private static List<Document> IDF(DataObject data) {
String searchQuery = data.getDataString();
List<Document> r=new ArrayList<>();
String[] terms = searchQuery.split("\\s+");
// Step 2: Use ExecutorService for parallel processing
ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
try {
List<Callable<Document>> tasks=new ArrayList<>();
List<Future<Document>> futures = new ArrayList<>(); // Step 3: Submit a task for each file to the ExecutorService
for (String fileName : data.getFileNames()) {
File file = new File("C:\\Users\\Abdullah\\Downloads\\network-communication-master\\Cordinator_Worker\\src\\main\\resources\\" + fileName);
Callable<Document> task = () -> processFile(file, terms);
tasks.add(task);
futures.add(executorService.submit(task));
}
executorService.awaitTermination(2, TimeUnit.MILLISECONDS);
// Step 4: Retrieve results from Future and merge into the 'r' list
for (Future<Document> future : futures) {
try {
Document document = future.get();
r.add(document);
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
// Step 5: Shutdown the ExecutorService
executorService.shutdown();
}
// Step 6: Return the final IDF map
return r;
}
// Function to process each file and calculate term frequencies
private static Document processFile(File file, String[] terms) {
Document document = new Document(file.getName());
int totalWords = 0;
try {
// Read content from the file
String content = new String(Files.readAllBytes(file.toPath()));
String[] words = content.split("\\s+");
// Calculate term frequencies in the file
for (String term : terms) {
int frequency = 0;
for (String word : words) {
if (word.equals(term)) {
frequency++;
}
totalWords++;
}
document.setTf(term, (double) (frequency / totalWords));
}
} catch (IOException e) {
e.printStackTrace();
// Handle file reading exception
}finally {
return document;
}
}
private static synchronized void addToDocuments(Document document) {
documents.add(document);
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getNodeName() {
return nodeName;
}
public static List<String> getIpAddress(List<Worker> workers) {
List<String> allAddress = new ArrayList<>();
for (Worker worker : workers) {
allAddress.add(worker.ipAddress);
}
return allAddress;
}
public String getIpAddress() {
return ipAddress;
}
public String getUserName() {
return userName;
}
}
package Zookeeper;
import org.apache.zookeeper.*;
import org.apache.zookeeper.data.Stat;
import java.util.Collections;
import java.util.List;
public class LeaderElection implements Watcher {
private static final String ELECTION_NAMESPACE = "/election";
private String currentZnodeName;
private ZooKeeper zooKeeper;
private OnElectionCallback onElectionCallback;
public LeaderElection(ZooKeeper zooKeeper, OnElectionCallback onElectionCallback) {
this.zooKeeper = zooKeeper;
this.onElectionCallback = onElectionCallback;
}
public void volunteerForLeadership() throws InterruptedException, KeeperException {
String znodePrefix = ELECTION_NAMESPACE + "/c_";
String znodeFullPath = zooKeeper.create(znodePrefix, new byte[]{}, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL);
System.out.println(znodeFullPath);
this.currentZnodeName = znodeFullPath.replace(ELECTION_NAMESPACE + "/", "");
}
public void reelectLeader() throws InterruptedException, KeeperException {
String predecessorName = "";
Stat predecessorStat = null;
//this while to guarantee get predecessor even if it deleted just before zookeeper.exist
while (predecessorStat == null) {
List<String> children = zooKeeper.getChildren(ELECTION_NAMESPACE, false);
Collections.sort(children);
String smallestChild = children.get(0); //the first element
if (smallestChild.equals(currentZnodeName)) {
System.out.println("I'm a leader");
onElectionCallback.onElectedToBeLeader();
return;
} else {
System.out.println("I'm not a leader");
int predecessorIndex = children.indexOf(currentZnodeName) - 1;
predecessorName = children.get(predecessorIndex);
predecessorStat = zooKeeper.exists(ELECTION_NAMESPACE + "/" + predecessorName, this);
}
}
onElectionCallback.onWorker();
System.out.println("Watching znode " + predecessorName);
System.out.println();
}
@Override
public void process(WatchedEvent watchedEvent) {
switch (watchedEvent.getType()) {
case NodeDeleted:
try {
reelectLeader();
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (KeeperException e) {
throw new RuntimeException(e);
}
break;
}
}
}
package Zookeeper;
import Coordinator_Worker.Coordinator;
import Coordinator_Worker.Worker;
import org.apache.zookeeper.KeeperException;
public class OnElectionAction implements OnElectionCallback {
private final ServiceRegistry serviceRegistry;
private final int port;
public OnElectionAction(ServiceRegistry serviceRegistry, int port) {
this.serviceRegistry = serviceRegistry;
this.port = port;
}
@Override
public void onElectedToBeLeader() throws InterruptedException, KeeperException {
serviceRegistry.unregisterFromCluster();
serviceRegistry.registerForUpdates();
Thread.sleep(30000);
Coordinator.startCoordinator();
}
@Override
public void onWorker() {
try {
String username = System.getProperty("user.name");
String currentServerAddress =
"192.168.56.116"+","+username+"," +port;
serviceRegistry.registerToCluster(currentServerAddress);
Worker.startWorker();
} catch (InterruptedException e) {
e.printStackTrace();
}catch (KeeperException e) {
e.printStackTrace();
}
}
}
package Zookeeper;
import org.apache.zookeeper.KeeperException;
public interface OnElectionCallback {
void onElectedToBeLeader() throws InterruptedException, KeeperException;
void onWorker();
}
package Zookeeper;
import Coordinator_Worker.Worker;
import ch.qos.logback.classic.Logger;
import org.apache.zookeeper.*;
import org.apache.zookeeper.data.Stat;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
public class ServiceRegistry implements Watcher {
private static final String REGISTRY_ZNODE = "/service_registry";
private final ZooKeeper zooKeeper;
private String currentZnode = null;
private static final Logger logger = (Logger) LoggerFactory.getLogger(ServiceRegistry.class);
private static List<Worker> workers= new ArrayList<>();
//private Autohealer autohealer;
public ServiceRegistry(ZooKeeper zooKeeper) {
//this.autohealer=autohealer;
this.zooKeeper = zooKeeper;
createServiceRegistryZnode();
}
private void createServiceRegistryZnode() {
try {
if (zooKeeper.exists(REGISTRY_ZNODE, false) == null) {
zooKeeper.create(REGISTRY_ZNODE, new byte[]{}, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
}
} catch (KeeperException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void registerToCluster(String metadata) throws KeeperException, InterruptedException {
if (this.currentZnode != null) {
logger.info("Already registered to service registry");
return;
}
this.currentZnode = zooKeeper.create(REGISTRY_ZNODE + "/n_", metadata.getBytes(),
ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL);
logger.info("Registered to service registry");
}
public void registerForUpdates() {
try {
updateAddresses();
} catch (KeeperException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void unregisterFromCluster() {
try {
if (currentZnode != null && zooKeeper.exists(currentZnode, false) != null) {
zooKeeper.delete(currentZnode, -1);
}
} catch (KeeperException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private synchronized void updateAddresses() throws KeeperException, InterruptedException {
System.out.println("Enter");
List<String> workerZnodes = zooKeeper.getChildren(REGISTRY_ZNODE, this);
// SortNodes(workerZnodes);
// List<String> addresses = new ArrayList<>();
// List<String> names = new ArrayList<>();
List<Worker> workerList= new ArrayList<>();
Thread.sleep(100);
for (String workerZnode : workerZnodes) {
String workerFullPath = REGISTRY_ZNODE + "/" + workerZnode;
Worker newWorker = new Worker(workerZnode);
Stat stat = zooKeeper.exists(workerFullPath, false);
if (stat == null) {
continue;
}
byte[] addressBytes = zooKeeper.getData(workerFullPath, false, stat);
String data = new String(addressBytes);
String[] parts = data.split(",");
String address = parts[0];
newWorker.setIpAddress(address);
newWorker.setUserName(parts[1]);
workerList.add(newWorker);
}
// Worker.SortNodes(workerList);
System.out.println(workers);
if(workers!=null)
workers.removeAll(workers);
if(workerList!=null)
workers.addAll(workerList);
logger.info("The cluster addresses are: " + Worker.getIpAddress(workers));
}
@Override
public void process(WatchedEvent watchedEvent) {
try {
updateAddresses();
System.out.println(workers);
Thread.sleep(1000);
} catch (KeeperException e) {
throw new RuntimeException(e);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
public static List<Worker> getWorkers() {
return workers;
}
}
\ No newline at end of file
fadfma the the fadfma the the fadfma the the fadfma the the fadfma the the fadfma the thev fadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the car
carcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcar car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""
car ""
car ""car ""car ""
car ""
car ""car ""
car ""
car ""car ""
car ""
vcar ""
car ""car ""car ""car ""car ""v
fadfma the the fadfma the the fadfma the the fadfma the the fadfma the the fadfma the thev fadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the car
carcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcar car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""
car ""
car ""car ""car ""
car ""
car ""car ""
car ""
car ""car ""
car ""
vcar ""
car ""car ""car ""car ""car ""v
fadfma the the fadfma the the fadfma the the fadfma the the fadfma the the fadfma the thev fadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the car
carcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcar car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""
car ""
car ""car ""car ""
car ""
car ""car ""
car ""
car ""car ""
car ""
vcar ""
car ""car ""car ""car ""car ""v
fadfma the the fadfma the the fadfma the the fadfma the the fadfma the the fadfma the thev fadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the car
carcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcar car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""
car ""
car ""car ""car ""
car ""
car ""car ""
car ""
car ""car ""
car ""
vcar ""
car ""car ""car ""car ""car ""v
fadfma the the fadfma the the fadfma the the fadfma the the fadfma the the fadfma the thev fadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the
fadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the thefadfma the the car
carcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcarcar car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""car ""
car ""
car ""car ""car ""
car ""
car ""car ""
car ""
car ""car ""
car ""
vcar ""
car ""car ""car ""car ""car ""v
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="HOME_LOG" value="logs/app.log"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n
</Pattern>
</layout>
</appender>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${HOME_LOG}</file>
<append>true</append>
<immediateFlush>true</immediateFlush>
<encoder>
<pattern>%d %p %c{1.} [%t] %m%n</pattern>
</encoder>
</appender>
<!-- Log Level: ERROR, WARN, INFO, DEBUG, TRACE-->
<logger name="Zookeeper" level="DEBUG" additivity="false">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</logger>
<root level="error">
<appender-ref ref="FILE"/>
</root>
</configuration>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment