Commit 6a10777c by amir

end of day commits

parent 580e6bdd
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
<y:Shape type="roundrectangle"/> <y:Shape type="roundrectangle"/>
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/> <y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/> <y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="13" leftF="13.19248789009768" right="0" rightF="0.0" top="1" topF="1.23046875"/> <y:BorderInsets bottom="0" bottomF="0.0" left="13" leftF="13.19248789009768" right="89" rightF="89.27875605495115" top="1" topF="1.23046875"/>
</y:GroupNode> </y:GroupNode>
<y:GroupNode> <y:GroupNode>
<y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/> <y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
...@@ -247,24 +247,6 @@ ...@@ -247,24 +247,6 @@
<node id="n2::n0"> <node id="n2::n0">
<data key="d6"> <data key="d6">
<y:ShapeNode> <y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="6.0" y="-126.91145833333343"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
<node id="n2::n1">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="-83.27875605495115" y="-126.91145833333343"/> <y:Geometry height="31.0" width="58.0" x="-83.27875605495115" y="-126.91145833333343"/>
<y:Fill color="#009688" transparent="false"/> <y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/> <y:BorderStyle hasColor="false" type="line" width="1.0"/>
...@@ -362,7 +344,7 @@ ...@@ -362,7 +344,7 @@
<y:Shape type="roundrectangle"/> <y:Shape type="roundrectangle"/>
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/> <y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/> <y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/> <y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="104" rightF="103.5" top="0" topF="0.0"/>
</y:GroupNode> </y:GroupNode>
<y:GroupNode> <y:GroupNode>
<y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/> <y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
...@@ -396,24 +378,6 @@ ...@@ -396,24 +378,6 @@
</y:ShapeNode> </y:ShapeNode>
</data> </data>
</node> </node>
<node id="n4::n1">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="6.0" y="-323.0638020833334"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
</graph> </graph>
</node> </node>
<node id="n5" yfiles.foldertype="group"> <node id="n5" yfiles.foldertype="group">
...@@ -429,7 +393,7 @@ ...@@ -429,7 +393,7 @@
<y:Shape type="roundrectangle"/> <y:Shape type="roundrectangle"/>
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/> <y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/> <y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/> <y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="104" rightF="103.5" top="0" topF="0.0"/>
</y:GroupNode> </y:GroupNode>
<y:GroupNode> <y:GroupNode>
<y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/> <y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
...@@ -463,24 +427,6 @@ ...@@ -463,24 +427,6 @@
</y:ShapeNode> </y:ShapeNode>
</data> </data>
</node> </node>
<node id="n5::n1">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="6.0" y="-225.60286458333343"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
</graph> </graph>
</node> </node>
<node id="n6" yfiles.foldertype="group"> <node id="n6" yfiles.foldertype="group">
...@@ -557,7 +503,7 @@ Function<y:LabelModel> ...@@ -557,7 +503,7 @@ Function<y:LabelModel>
<y:ProxyAutoBoundsNode> <y:ProxyAutoBoundsNode>
<y:Realizers active="0"> <y:Realizers active="0">
<y:GroupNode> <y:GroupNode>
<y:Geometry height="137.68718749999948" width="143.73000000000002" x="145.0" y="-111.37239583333343"/> <y:Geometry height="137.68718749999948" width="143.73000000000002" x="130.72124394504885" y="79.77151041666554"/>
<y:Fill color="#F5F5F5" transparent="false"/> <y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/> <y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="143.73000000000002" x="0.0" y="0.0">Client Send</y:NodeLabel> <y:NodeLabel alignment="center" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="143.73000000000002" x="0.0" y="0.0">Client Send</y:NodeLabel>
...@@ -583,7 +529,7 @@ Function<y:LabelModel> ...@@ -583,7 +529,7 @@ Function<y:LabelModel>
<node id="n7::n0"> <node id="n7::n0">
<data key="d6"> <data key="d6">
<y:ShapeNode> <y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="160.0" y="-74.91145833333343"/> <y:Geometry height="31.0" width="58.0" x="145.72124394504885" y="116.23244791666554"/>
<y:Fill color="#009688" transparent="false"/> <y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/> <y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
...@@ -601,7 +547,7 @@ Function<y:LabelModel> ...@@ -601,7 +547,7 @@ Function<y:LabelModel>
<node id="n7::n1"> <node id="n7::n1">
<data key="d6"> <data key="d6">
<y:ShapeNode> <y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="185.365" y="-49.29833333333369"/> <y:Geometry height="31.0" width="58.0" x="171.08624394504886" y="141.84557291666528"/>
<y:Fill color="#009688" transparent="false"/> <y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/> <y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
...@@ -619,7 +565,7 @@ Function<y:LabelModel> ...@@ -619,7 +565,7 @@ Function<y:LabelModel>
<node id="n7::n2"> <node id="n7::n2">
<data key="d6"> <data key="d6">
<y:ShapeNode> <y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="210.73000000000002" y="-24.685208333333946"/> <y:Geometry height="31.0" width="58.0" x="196.45124394504887" y="166.45869791666502"/>
<y:Fill color="#009688" transparent="false"/> <y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/> <y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
...@@ -640,12 +586,13 @@ Function<y:LabelModel> ...@@ -640,12 +586,13 @@ Function<y:LabelModel>
<data key="d5"/> <data key="d5"/>
<data key="d6"> <data key="d6">
<y:GenericNode configuration="com.yworks.flowchart.annotation"> <y:GenericNode configuration="com.yworks.flowchart.annotation">
<y:Geometry height="55.0" width="99.0" x="318.73" y="-107.83536458333356"/> <y:Geometry height="55.0" width="99.0" x="318.73" y="121.11510416666528"/>
<y:Fill hasColor="false" transparent="false"/> <y:Fill hasColor="false" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/> <y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="45.90625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="95.646484375" x="1.6767578125" y="4.546875">Connection per <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="59.875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="113.2421875" x="-7.12109375" y="-2.4375">Connection per
Thread Thread
(Thread Local)<y:LabelModel> (Thread Local)
or ConnectionPool<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/> <y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel> </y:LabelModel>
<y:ModelParameter> <y:ModelParameter>
...@@ -795,17 +742,116 @@ Function<y:LabelModel> ...@@ -795,17 +742,116 @@ Function<y:LabelModel>
</node> </node>
</graph> </graph>
</node> </node>
<edge id="e0" source="n1::n1" target="n5::n0"> <node id="n11" yfiles.foldertype="group">
<data key="d10"> <data key="d4"/>
<y:PolyLineEdge> <data key="d6">
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:ProxyAutoBoundsNode>
<y:LineStyle color="#000000" type="line" width="1.0"/> <y:Realizers active="0">
<y:Arrows source="none" target="standard"/> <y:GroupNode>
<y:BendStyle smoothed="false"/> <y:Geometry height="144.80062499999946" width="143.88497578019542" x="133.9424878900977" y="-87.91567708333395"/>
</y:PolyLineEdge> <y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="143.88497578019542" x="0.0" y="0.0">Server Send</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="7" bottomF="7.2491666666673495" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
<y:GroupNode>
<y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="65.201171875" x="-7.6005859375" y="0.0">Folder 9</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="true" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
</y:Realizers>
</y:ProxyAutoBoundsNode>
</data> </data>
</edge> <graph edgedefault="directed" id="n11:">
<edge id="e1" source="n5::n1" target="n0::n0"> <node id="n11::n0">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="148.9424878900977" y="-51.45473958333395"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
<node id="n11::n1">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="174.88497578019542" y="-25.909479166667893"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
<node id="n11::n2">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="199.82746367029313" y="-1.3642187500018395"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
</graph>
</node>
<node id="n12">
<data key="d5"/>
<data key="d6">
<y:GenericNode configuration="com.yworks.flowchart.annotation">
<y:Geometry height="55.0" width="99.0" x="327.76995156039084" y="-43.01536458333422"/>
<y:Fill hasColor="false" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="59.875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="113.2421875" x="-7.12109375" y="-2.4375">Connection per
Thread
(Thread Local)
or ConnectionPool<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.lang.Byte" name="com.yworks.flowchart.style.orientation" value="0"/>
<y:Property class="java.lang.Byte" name="LAYER_STYLE_PROPERTY_KEY" value="1"/>
</y:StyleProperties>
</y:GenericNode>
</data>
</node>
<edge id="e0" source="n1::n1" target="n5::n0">
<data key="d10"> <data key="d10">
<y:PolyLineEdge> <y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
...@@ -869,7 +915,7 @@ Function<y:LabelModel> ...@@ -869,7 +915,7 @@ Function<y:LabelModel>
</y:PolyLineEdge> </y:PolyLineEdge>
</data> </data>
</edge> </edge>
<edge id="e2" source="n10" target="n9"> <edge id="e1" source="n10" target="n9">
<data key="d9"/> <data key="d9"/>
<data key="d10"> <data key="d10">
<y:PolyLineEdge> <y:PolyLineEdge>
...@@ -883,7 +929,7 @@ Function<y:LabelModel> ...@@ -883,7 +929,7 @@ Function<y:LabelModel>
</y:PolyLineEdge> </y:PolyLineEdge>
</data> </data>
</edge> </edge>
<edge id="e3" source="n3" target="n6"> <edge id="e2" source="n3" target="n6">
<data key="d9"/> <data key="d9"/>
<data key="d10"> <data key="d10">
<y:PolyLineEdge> <y:PolyLineEdge>
...@@ -894,7 +940,7 @@ Function<y:LabelModel> ...@@ -894,7 +940,7 @@ Function<y:LabelModel>
</y:PolyLineEdge> </y:PolyLineEdge>
</data> </data>
</edge> </edge>
<edge id="e4" source="n4" target="n2"> <edge id="e3" source="n4" target="n2">
<data key="d9"/> <data key="d9"/>
<data key="d10"> <data key="d10">
<y:PolyLineEdge> <y:PolyLineEdge>
...@@ -908,16 +954,35 @@ Function<y:LabelModel> ...@@ -908,16 +954,35 @@ Function<y:LabelModel>
</y:PolyLineEdge> </y:PolyLineEdge>
</data> </data>
</edge> </edge>
<edge id="e5" source="n4" target="n2"> <edge id="e4" source="n8" target="n7">
<data key="d9"/> <data key="d9"/>
<data key="d10"> <data key="d10">
<y:PolyLineEdge> <y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:Point x="107.36500000000001" y="-315.7942708333334"/>
<y:Point x="107.36500000000001" y="-120.25716145833343"/>
</y:Path>
<y:LineStyle color="#000000" type="line" width="1.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="none"/> <y:Arrows source="none" target="standard"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="e5" source="n11" target="n0">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="standard"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="e6" source="n12" target="n11">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="71.11502421980458" ty="0.0"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="standard"/>
<y:BendStyle smoothed="false"/> <y:BendStyle smoothed="false"/>
</y:PolyLineEdge> </y:PolyLineEdge>
</data> </data>
......

40.2 KB | W: | H:

44.7 KB | W: | H:

doc/ZMQRestService.png
doc/ZMQRestService.png
doc/ZMQRestService.png
doc/ZMQRestService.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -14,6 +14,7 @@ import microservice.io.impl.*; ...@@ -14,6 +14,7 @@ import microservice.io.impl.*;
import microservice.params.RMQClientParams; import microservice.params.RMQClientParams;
import microservice.params.RestServerParams; import microservice.params.RestServerParams;
import microservice.services.CommonServices;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import rabbitmq.common.RMQId; import rabbitmq.common.RMQId;
...@@ -23,11 +24,8 @@ import rabbitmq.server.RMQServer; ...@@ -23,11 +24,8 @@ import rabbitmq.server.RMQServer;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.stream.Stream;
import static io.undertow.Handlers.resource; import static io.undertow.Handlers.resource;
import static microservice.handlers.MonitorHandler.MON_PREFIX;
/* /*
* TO DO: * TO DO:
......
...@@ -5,8 +5,7 @@ import java.util.Map; ...@@ -5,8 +5,7 @@ import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import microservice.defs.Enums; import microservice.services.CommonServices;
import microservice.io.iface.CommonServices;
import microservice.io.iface.IContainer; import microservice.io.iface.IContainer;
import microservice.io.iface.IRequest; import microservice.io.iface.IRequest;
import microservice.io.iface.IResponse; import microservice.io.iface.IResponse;
......
...@@ -8,7 +8,7 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory; ...@@ -8,7 +8,7 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import microservice.MicroserviceApp; import microservice.MicroserviceApp;
import microservice.defs.Enums; import microservice.defs.Enums;
import microservice.io.iface.CommonServices; import microservice.services.CommonServices;
import microservice.io.iface.IConfiguration; import microservice.io.iface.IConfiguration;
import microservice.io.impl.IMetricsFactoryImpl; import microservice.io.impl.IMetricsFactoryImpl;
import microservice.types.BaseRestResponse; import microservice.types.BaseRestResponse;
......
...@@ -3,7 +3,7 @@ package microservice.handlers; ...@@ -3,7 +3,7 @@ package microservice.handlers;
import io.undertow.util.PathTemplateMatcher; import io.undertow.util.PathTemplateMatcher;
import microservice.defs.Constants; import microservice.defs.Constants;
import microservice.defs.Enums; import microservice.defs.Enums;
import microservice.io.iface.CommonServices; import microservice.services.CommonServices;
import microservice.io.iface.ILogger; import microservice.io.iface.ILogger;
import microservice.io.iface.IMetricsFactory; import microservice.io.iface.IMetricsFactory;
......
package microservice.handlers; package microservice.handlers;
import com.eaio.uuid.UUID; import com.eaio.uuid.UUID;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
import io.jsonwebtoken.ExpiredJwtException; import io.jsonwebtoken.ExpiredJwtException;
...@@ -21,6 +20,7 @@ import microservice.io.iface.IMetricsFactory.ITimer; ...@@ -21,6 +20,7 @@ import microservice.io.iface.IMetricsFactory.ITimer;
import microservice.io.impl.IMetricsFactoryImpl; import microservice.io.impl.IMetricsFactoryImpl;
import microservice.io.impl.IRequestRestImpl; import microservice.io.impl.IRequestRestImpl;
import microservice.io.impl.IResponseRestImpl; import microservice.io.impl.IResponseRestImpl;
import microservice.services.CommonServices;
import microservice.types.BaseRestResponse; import microservice.types.BaseRestResponse;
import microservice.types.UserProfile; import microservice.types.UserProfile;
......
...@@ -18,6 +18,8 @@ public interface IContainer ...@@ -18,6 +18,8 @@ public interface IContainer
{ {
public static Pattern slashSeperatorPattern = Pattern.compile("/"); public static Pattern slashSeperatorPattern = Pattern.compile("/");
public static Pattern spaceSeperatorPattern = Pattern.compile(" "); public static Pattern spaceSeperatorPattern = Pattern.compile(" ");
public static Pattern queryParamsSeperatorPattern = Pattern.compile("&");
public static Pattern keyvalParamSeperatorPattern = Pattern.compile("=");
public void sendErrorResp(IResponse response, String error); public void sendErrorResp(IResponse response, String error);
......
package microservice.io.iface; package microservice.services;
import microservice.defs.Enums; import microservice.defs.Enums;
import microservice.io.iface.IRequest;
import microservice.io.iface.IResponse;
import microservice.io.iface.IServiceDiscovery;
import microservice.params.CommandParams; import microservice.params.CommandParams;
import microservice.types.BaseRestResponse; import microservice.types.BaseRestResponse;
......
package microservice.io.impl.service; package microservice.services;
import com.fasterxml.jackson.databind.JsonNode; import microservice.services.CommonServices;
import common.JsonHandler;
import microservice.io.iface.CommonServices;
import microservice.io.iface.IServiceDiscovery; import microservice.io.iface.IServiceDiscovery;
import org.eclipse.paho.client.mqttv3.*; import org.eclipse.paho.client.mqttv3.*;
......
package microservice.io.impl.service; package microservice.services;
import com.eaio.uuid.UUID; import com.eaio.uuid.UUID;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import common.Network; import common.Network;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
...@@ -28,6 +27,7 @@ import microservice.io.impl.IRequestRestImpl; ...@@ -28,6 +27,7 @@ import microservice.io.impl.IRequestRestImpl;
import microservice.io.impl.IResponseRestImpl; import microservice.io.impl.IResponseRestImpl;
import microservice.params.CommandParams; import microservice.params.CommandParams;
import microservice.params.RestServerParams; import microservice.params.RestServerParams;
import microservice.services.CommonServices;
import microservice.types.BaseRestResponse; import microservice.types.BaseRestResponse;
import microservice.types.UserProfile; import microservice.types.UserProfile;
......
package microservice.io.impl.service; package microservice.services;
import io.undertow.server.HttpHandler; import com.eaio.uuid.UUID;
import io.undertow.server.HttpServerExchange; import com.fasterxml.jackson.databind.ObjectMapper;
import microservice.MicroserviceApp; import microservice.MicroserviceApp;
import microservice.common.context.RestContext; import microservice.common.context.RestContext;
import microservice.common.context.RestMsg;
import microservice.defs.Constants; import microservice.defs.Constants;
import microservice.defs.Enums;
import microservice.handlers.Reactor; import microservice.handlers.Reactor;
import microservice.io.iface.*; import microservice.io.iface.*;
import microservice.params.CommandParams; import microservice.params.CommandParams;
import microservice.params.ZMQParams; import microservice.params.ZMQParams;
import microservice.services.protocol.zmq.RestImpl;
import microservice.types.BaseRestResponse; import microservice.types.BaseRestResponse;
import microservice.utils.ZSocketPool;
import org.zeromq.ZMQ; import org.zeromq.ZMQ;
import org.zeromq.ZSocket; import org.zeromq.ZSocket;
import java.util.ArrayList; import java.nio.ByteBuffer;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static microservice.defs.Constants.EXIT_MSG;
import static microservice.defs.Constants.EXIT_MSG_LEN;
/** /**
* Created by amir on 14/05/17. * Created by amir on 14/05/17.
...@@ -47,6 +54,7 @@ import java.util.function.Consumer; ...@@ -47,6 +54,7 @@ import java.util.function.Consumer;
*/ */
public class IRestServiceZmqImpl extends CommonServices.IRestService implements IContainer { public class IRestServiceZmqImpl extends CommonServices.IRestService implements IContainer {
static final String MAINT_CHANNEL = "inproc://maint"; static final String MAINT_CHANNEL = "inproc://maint";
public static final int CAPACITY = 1024;
private String appName; private String appName;
private ZMQParams.ServerParams serverParams = null; private ZMQParams.ServerParams serverParams = null;
...@@ -56,13 +64,9 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements ...@@ -56,13 +64,9 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements
private int numOfClientWorkers = 0; private int numOfClientWorkers = 0;
private int numOfServerWorkers = 0; private int numOfServerWorkers = 0;
List<ClientWorker> clientWorkerList = new ArrayList<>();
IWorker clientReceive = null;
IWorker serverReceive = null;
IWorker serverWorker = null;
IWorker serverReply = null;
ClientSend clientSend = null;
List<IWorker> allWorkersList = new ArrayList<>(); List<IWorker> allWorkersList = new ArrayList<>();
ZSocketPool clientSendPool = null;
ZSocketPool serverSendPool = null;
public static class CacheEntry { public static class CacheEntry {
BiConsumer<String,Integer> onResponseFunc; BiConsumer<String,Integer> onResponseFunc;
...@@ -76,26 +80,27 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements ...@@ -76,26 +80,27 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements
abstract void stop() throws InterruptedException; abstract void stop() throws InterruptedException;
} }
public static class ClientSend {
private ThreadLocal<ZSocket> clientSend = null;
public ZSocket getSocket() {
return clientSend.get();
}
public ClientSend(final String address) { // public static class ClientSend {
clientSend = new ThreadLocal<ZSocket>(){ // private ThreadLocal<ZSocket> clientSend = null;
@Override protected ZSocket initialValue() { // public ZSocket getSocket() {
ZSocket socket = new ZSocket(ZMQ.PUSH); // return clientSend.get();
System.out.println("Connectring to:" + address); // }
if (socket.connect(address) == false) { //
System.err.println("Failed Connecting to:" + address); // public ClientSend(final String address) {
socket = null; // clientSend = new ThreadLocal<ZSocket>(){
} // @Override protected ZSocket initialValue() {
return socket; // ZSocket socket = new ZSocket(ZMQ.PUSH);
} // System.out.println("Connectring to:" + address);
}; // if (socket.connect(address) == false) {
} // System.err.println("Failed Connecting to:" + address);
} // socket = null;
// }
// return socket;
// }
// };
// }
// }
public static class ClientWorker extends IWorker { public static class ClientWorker extends IWorker {
public static final String ADDRESS = "inproc://ClientWorker"; public static final String ADDRESS = "inproc://ClientWorker";
...@@ -104,8 +109,8 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements ...@@ -104,8 +109,8 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements
@Override @Override
boolean init() { boolean init() {
pull = new ZSocket(ZMQ.PULL);
return true; return pull.bind(ADDRESS);
} }
@Override @Override
...@@ -122,7 +127,7 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements ...@@ -122,7 +127,7 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements
if (runThread != null){ if (runThread != null){
ZSocket exitSocket = new ZSocket(ZMQ.PUSH); ZSocket exitSocket = new ZSocket(ZMQ.PUSH);
exitSocket.connect(ADDRESS); exitSocket.connect(ADDRESS);
exitSocket.send(Constants.EXIT_MSG.getBytes()); exitSocket.send(EXIT_MSG.getBytes());
runThread.join(); runThread.join();
} }
} }
...@@ -142,8 +147,9 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements ...@@ -142,8 +147,9 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements
@Override @Override
boolean init() { boolean init() {
push = new ZSocket(ZMQ.PUSH);
return true; pull = new ZSocket(ZMQ.PULL);
return pull.bind(zmqParams.bindAddress()) && push.connect(ClientWorker.ADDRESS);
} }
@Override @Override
...@@ -159,7 +165,7 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements ...@@ -159,7 +165,7 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements
if (runThread != null){ if (runThread != null){
ZSocket exitSocket = new ZSocket(ZMQ.PUSH); ZSocket exitSocket = new ZSocket(ZMQ.PUSH);
exitSocket.connect(zmqParams.bindAddress()); exitSocket.connect(zmqParams.bindAddress());
exitSocket.send(Constants.EXIT_MSG.getBytes()); exitSocket.send(EXIT_MSG.getBytes());
runThread.join(); runThread.join();
} }
} }
...@@ -192,7 +198,21 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements ...@@ -192,7 +198,21 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements
@Override @Override
void start() { void start() {
runThread = new Thread(() -> { runThread = new Thread(() -> {
/**
* ZMQ Pull socket receive the msg, validate it and push (inproc) it the Workers
*/
boolean keepRunning = true;
while (keepRunning) {
final byte[] msgBytes = pull.receive();
if (msgBytes.length > EXIT_MSG_LEN) {
push.send(msgBytes, ZMQ.DONTWAIT);
} else {
String msg = new String(msgBytes);
if (msg.equals(EXIT_MSG) ) {
keepRunning = false;
}
}
}
}); });
runThread.start(); runThread.start();
} }
...@@ -202,47 +222,141 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements ...@@ -202,47 +222,141 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements
if (runThread != null){ if (runThread != null){
ZSocket exitSocket = new ZSocket(ZMQ.PUSH); ZSocket exitSocket = new ZSocket(ZMQ.PUSH);
exitSocket.connect(zmqParams.bindAddress()); exitSocket.connect(zmqParams.bindAddress());
exitSocket.send(Constants.EXIT_MSG.getBytes()); exitSocket.send(EXIT_MSG.getBytes());
runThread.join(); runThread.join();
} }
} }
} }
public static class ServerWorker extends IWorker { public static class ServerWorker extends IWorker implements IContainer{
public static final String ADDRESS = "inproc://ServerWorker"; public static final String ADDRESS = "inproc://ServerWorker";
private ZSocket pull = null; private ZSocket pull = null;
private ZSocket push = null;
private CommonServices.IServiceReactor reactor = null; private CommonServices.IServiceReactor reactor = null;
private CommonServices.IRestService parentService = null;
public ServerWorker(CommonServices.IServiceReactor reactor) { public ObjectMapper objMapper = null;
public ServerWorker(CommonServices.IServiceReactor reactor,CommonServices.IRestService parentService) {
this.reactor = reactor; this.reactor = reactor;
this.parentService = parentService;
} }
@Override @Override
boolean init() { boolean init() {
push = new ZSocket(ZMQ.PUSH);
pull = new ZSocket(ZMQ.PULL); pull = new ZSocket(ZMQ.PULL);
objMapper = new ObjectMapper();
return pull.bind(ADDRESS) && push.connect(ServerReply.ADDRESS); return pull.bind(ADDRESS);
} }
@Override @Override
void start() { void start() {
/**
* the worker threads create the {@link RestContext} <br>
* and Delegate it to the {@link microservice.handlers.Reactor}, Upon response, the worker thread
*/
runThread = new Thread(() -> { runThread = new Thread(() -> {
boolean keepRunning = true;
while (keepRunning) {
final byte[] msgBytes = pull.receive();
if (msgBytes.length > EXIT_MSG_LEN) {
ByteBuffer bb = ByteBuffer.wrap(msgBytes);
RestMsg receiveMsg = RestMsg.getRootAsRestMsg(bb);
if (receiveMsg != null){
RestContext restContext = getRequestContext(receiveMsg);
if (restContext != null){
String key = Reactor.buildServiceKey(Enums.EnumServiceType.E_REST,
restContext.enumRestCommands,
restContext.request.getRelativePath());
reactor.delegate(parentService, key ,restContext);
} else {
parentService.sendErrorResp(restContext.response, Constants.METHOD_NOT_IMPLEMENTED);
}
} else {
System.err.println(getClass().getName() + " >> Failed to get RestContext from msg");
}
} else {
String msg = new String(msgBytes);
if (msg.equals(EXIT_MSG) ) {
keepRunning = false;
}
}
}
}); });
runThread.start(); runThread.start();
} }
private RestContext getRequestContext(RestMsg receiveMsg) {
RestContext reqCtx = new RestContext();
reqCtx.container = this;
reqCtx.request = new RestImpl.IRequestZmqRestImpl(receiveMsg);
reqCtx.response = new RestImpl.IResponseZmqRestImpl(receiveMsg);
reqCtx.objMapper = objMapper;
/*
* params
*/
String relativePath = receiveMsg.url();
if (relativePath != null && relativePath.length() > 1)
reqCtx.params = slashSeperatorPattern.split(relativePath.substring(1));
String queryString = receiveMsg.queryString();
if (queryString != null && !queryString.isEmpty())
{
Map<String, Deque<String>> queryParameters = getQueryParameters(queryString);
reqCtx.queryParameters = queryParameters;
}
/*
* rcid
*/
reqCtx.rcid = String.valueOf(receiveMsg.rcid());
if (reqCtx.rcid == null) // create a new one
reqCtx.rcid = new UUID().toString();
return reqCtx;
}
/**
* parsing and getting the query parameters as a map of deques
* @param queryString
* @return
*/
private Map<String, Deque<String>> getQueryParameters(String queryString) {
final List<String> stringList = Arrays.asList(queryParamsSeperatorPattern.split(queryString));
final Map<String, List<String[]>> stringListMap = stringList.stream().
map(s -> keyvalParamSeperatorPattern.split(s)).
collect(Collectors.groupingBy(sa -> sa[0]));
Map<String, Deque<String>> queryParameters = new TreeMap<>();
stringListMap.forEach((key,vals) -> {
Deque<String> stringDeque = new ArrayDeque<>(vals.size());
final List<String> list = vals.stream().map(sa -> sa.length == 2 ? sa[1] : null).collect(Collectors.toList());
stringDeque.addAll(list);
queryParameters.put(key,stringDeque);
});
return queryParameters;
}
@Override @Override
void stop() throws InterruptedException { void stop() throws InterruptedException {
if (runThread != null){ if (runThread != null){
ZSocket exitSocket = new ZSocket(ZMQ.PUSH); ZSocket exitSocket = new ZSocket(ZMQ.PUSH);
exitSocket.connect(ADDRESS); exitSocket.connect(ADDRESS);
exitSocket.send(Constants.EXIT_MSG.getBytes()); exitSocket.send(EXIT_MSG.getBytes());
runThread.join(); runThread.join();
} }
} }
@Override
public void sendErrorResp(IResponse response, String error) {
}
@Override
public void writeObjectToResponse(IResponse response, Object value) {
}
@Override
public Object readObjectFromRequest(IRequest request, Class<?> ObjClass) {
return null;
}
} }
public static class ServerReply extends IWorker { public static class ServerReply extends IWorker {
...@@ -269,13 +383,17 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements ...@@ -269,13 +383,17 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements
if (runThread != null){ if (runThread != null){
ZSocket exitSocket = new ZSocket(ZMQ.PUSH); ZSocket exitSocket = new ZSocket(ZMQ.PUSH);
exitSocket.connect(ADDRESS); exitSocket.connect(ADDRESS);
exitSocket.send(Constants.EXIT_MSG.getBytes()); exitSocket.send(EXIT_MSG.getBytes());
runThread.join(); runThread.join();
} }
} }
} }
public IRestServiceZmqImpl() {
}
@Override @Override
public BaseRestResponse create(CommandParams cmdParams) { public BaseRestResponse create(CommandParams cmdParams) {
return null; return null;
...@@ -363,18 +481,20 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements ...@@ -363,18 +481,20 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements
allWorkersList.stream().allMatch(IWorker::init)); allWorkersList.stream().allMatch(IWorker::init));
} }
public void allocateServer() { public boolean allocateServer() {
serverReceive = new ServerReceive(serverParams); allWorkersList.add(new ServerReceive(serverParams));
allWorkersList.add(serverReceive);
for (int i = 0; i < numOfServerWorkers; i++){ for (int i = 0; i < numOfServerWorkers; i++){
allWorkersList.add(new ServerWorker(reactor)); allWorkersList.add(new ServerWorker(reactor,this));
} }
/**
* init server send pool
*/
serverSendPool = ZSocketPool.buildPool(ServerReply.ADDRESS,ZMQ.PUSH,numOfServerWorkers);
return serverSendPool != null;
} }
public boolean allocateClient() { public boolean allocateClient() {
clientReceive = new ClientReceive(clientReceiveParams,responseCacheClient); allWorkersList.add(new ClientReceive(clientReceiveParams,responseCacheClient));
allWorkersList.add(clientReceive);
for (int i = 0; i < numOfClientWorkers; i++){ for (int i = 0; i < numOfClientWorkers; i++){
allWorkersList.add(new ClientWorker()); allWorkersList.add(new ClientWorker());
} }
...@@ -382,8 +502,9 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements ...@@ -382,8 +502,9 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements
/** /**
* init client send * init client send
*/ */
clientSend = new ClientSend(clientSendParams.bindAddress()); clientSendPool = ZSocketPool.buildPool(clientSendParams.bindAddress(),ZMQ.PUSH,numOfClientWorkers);
return clientSend.getSocket() != null; // clientSend = new ClientSend(clientSendParams.bindAddress());
return clientSendPool != null;
} }
@Override @Override
......
package microservice.services.protocol.zmq;
import microservice.common.context.RestMsg;
import microservice.io.iface.IRequest;
import microservice.io.iface.IResponse;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.List;
/**
* Created by amir on 22/05/17.
*/
public class RestImpl {
public static class IRequestZmqRestImpl implements IRequest {
RestMsg restMsg = null;
public IRequestZmqRestImpl(RestMsg restMsg) {
this.restMsg = restMsg;
}
@Override
public InputStream getInputStream() {
return null;
}
@Override
public String getQueryString() {
return null;
}
@Override
public String getRelativePath() {
return null;
}
@Override
public String getFirstHeader(String headerName) {
return null;
}
@Override
public List<String> getHeader(String headerName) {
return null;
}
@Override
public boolean startAsync(Runnable asyncFunc) {
return false;
}
}
public static class IResponseZmqRestImpl implements IResponse {
RestMsg restMsg = null;
public IResponseZmqRestImpl(RestMsg restMsg) {
this.restMsg = restMsg;
}
@Override
public void send(ByteBuffer buffer) {
}
@Override
public void send(String response) {
}
}
}
\ No newline at end of file
...@@ -2,8 +2,7 @@ package microservice.types; ...@@ -2,8 +2,7 @@ package microservice.types;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
import io.jsonwebtoken.impl.DefaultClaims; import io.jsonwebtoken.impl.DefaultClaims;
import microservice.defs.Enums; import microservice.services.CommonServices;
import microservice.io.iface.CommonServices;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
......
package microservice.utils; package microservice.utils;
import microservice.io.iface.CommonServices; import microservice.services.CommonServices;
import microservice.io.iface.IRestClient; import microservice.io.iface.IRestClient;
import microservice.io.impl.IRestClientHttpImpl; import microservice.io.impl.IRestClientHttpImpl;
import microservice.io.impl.service.IRestServiceHttpImpl; import microservice.services.IRestServiceHttpImpl;
import microservice.io.impl.service.IRestServiceZmqImpl; import microservice.services.IRestServiceZmqImpl;
import microservice.params.RestClientParams; import microservice.params.RestClientParams;
import microservice.params.RestServerParams; import microservice.params.RestServerParams;
import microservice.params.ZMQParams; import microservice.params.ZMQParams;
......
package microservice.utils;
import org.apache.commons.pool2.PooledObjectFactory;
import org.apache.commons.pool2.impl.GenericObjectPool;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import org.zeromq.ZSocket;
/**
* Created by amir on 22/05/17.
*/
public class ZSocketPool extends GenericObjectPool<ZSocket> {
public ZSocketPool(PooledObjectFactory<ZSocket> factory, int maxTotal) {
super(factory);
this.setMaxTotal(maxTotal);
}
public static ZSocketPool buildPool(String address, int socketType,int maxTotal){
return new ZSocketPool(new ZsocketPoolFactory(address, socketType),maxTotal);
}
}
package microservice.utils;
import org.apache.commons.pool2.BasePooledObjectFactory;
import org.apache.commons.pool2.PooledObject;
import org.apache.commons.pool2.impl.DefaultPooledObject;
import org.zeromq.ZSocket;
/**
* Created by amir on 22/05/17.
*/
public class ZsocketPoolFactory extends BasePooledObjectFactory<ZSocket> {
String address;
int socketType;
public ZsocketPoolFactory(String address, int socketType) {
this.address = address;
this.socketType = socketType;
}
@Override
public ZSocket create() throws Exception {
ZSocket socket = new ZSocket(socketType);
if (!socket.connect(address))
socket = null;
return socket;
}
@Override
public PooledObject<ZSocket> wrap(ZSocket obj) {
return new DefaultPooledObject<ZSocket>(obj);
}
@Override
public PooledObject<ZSocket> makeObject() throws Exception {
return super.makeObject();
}
@Override
public boolean validateObject(PooledObject<ZSocket> p) {
return super.validateObject(p);
}
@Override
public void activateObject(PooledObject<ZSocket> p) throws Exception {
super.activateObject(p);
}
@Override
public void passivateObject(PooledObject<ZSocket> p) throws Exception {
super.passivateObject(p);
}
}
...@@ -5,10 +5,10 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory; ...@@ -5,10 +5,10 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import microservice.common.context.RestContext; import microservice.common.context.RestContext;
import microservice.defs.Enums; import microservice.defs.Enums;
import microservice.io.iface.CommonServices; import microservice.services.CommonServices;
import microservice.io.iface.IRestClient; import microservice.io.iface.IRestClient;
import microservice.io.impl.*; import microservice.io.impl.*;
import microservice.io.impl.service.IRestServiceHttpImpl; import microservice.services.IRestServiceHttpImpl;
import microservice.params.*; import microservice.params.*;
import microservice.types.BaseRestResponse; import microservice.types.BaseRestResponse;
......
...@@ -2,20 +2,19 @@ package microservice; ...@@ -2,20 +2,19 @@ package microservice;
import com.google.common.cache.Cache; import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import common.CacheClient;
import common.GuavaCacheClient;
import io.undertow.predicate.Predicate; import io.undertow.predicate.Predicate;
import io.undertow.util.PathTemplateMatcher; import io.undertow.util.PathTemplateMatcher;
import microservice.io.iface.CommonServices; import microservice.services.CommonServices;
import org.junit.Test; import org.junit.Test;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.stream.Collectors;
/** /**
* Created by amir on 08/05/17. * Created by amir on 08/05/17.
...@@ -78,6 +77,57 @@ public class TestServicesAndMethods { ...@@ -78,6 +77,57 @@ public class TestServicesAndMethods {
// System.out.println("Found match: " + match.getMatchedTemplate()); // System.out.println("Found match: " + match.getMatchedTemplate());
} }
@Test
public void testMap(){
class Staff {
private String name;
private int age;
private String direction;
public Staff(String name, int age, String direction) {
this.name = name;
this.age = age;
this.direction = direction;
}
public String getName() {
return name;
}
public int getAge() {
return age;
}
public String getDirection() {
return direction;
}
@Override
public String toString() {
return "Staff{" +
"name='" + name + '\'' +
", age=" + age +
", direction='" + direction + '\'' +
'}';
}
}
//List<String> stringList = Arrays.asList("N", "S", "W", "E", "NW", "SW");
List<Staff> staff = Arrays.asList(
new Staff("mkyong", 30, "N"),
new Staff("jack", 27, "S"),
new Staff("lawrence", 33, "SW"),
new Staff("lucy", 33, "N")
);
//Java 8
// Map<String,String> map = staff.stream().collect(Collectors.toMap(Staff::getDirection,Staff::getName));
// System.out.println(map); //[mkyong, jack, lawrence]
final Map<String, List<Staff>> listMap = staff.stream().collect(Collectors.groupingBy(s -> s.getDirection()));
System.out.println(listMap); //[mkyong, jack, lawrence]
}
@Test @Test
public void testCache(){ public void testCache(){
......
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 sign in to comment