liurunyu
2023-12-04 d6670149331bbdeda4b0573927c13d36225a09c1
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/queue/Queue.java
@@ -4,7 +4,7 @@
import org.apache.logging.log4j.Logger;
/**
 * 队列,先进先出,非线程安全
 * 队列,先进先出
 */
public class Queue {
   @SuppressWarnings("unfinal")
@@ -62,7 +62,6 @@
    */
   @SuppressWarnings("unused")
   public void pushHead(NodeObj obj)throws Exception{
      //两个线程环境,需要同步锁
      synchronized(synObj){
         if(obj == null){
            return ;
@@ -90,7 +89,6 @@
    * @param obj 入列的对象
    */
   public void pushTail(NodeObj obj)throws Exception{
      //两个线程环境,需要同步锁
      synchronized(synObj){
         if(obj == null){
            return ;
@@ -118,7 +116,6 @@
    * @return 出列对象
    */
   public NodeObj pop(){
      //两个线程环境,需要同步锁
      synchronized(synObj){
         NodeObj obj = null ;
         if(this.size > 0){
@@ -142,14 +139,11 @@
    */
   @SuppressWarnings("unused")
   public Node getFirstNode(){
      //两个线程环境,需要同步锁
      synchronized(synObj) {
         Node node = this.head.next;
         if (node != this.tail) {
            return node;
         }
         return null;
      Node node = this.head.next ;
      if(node != this.tail){
         return node ;
      }
      return null ;
   }
   /**
    * 得到最后一个节点,但不把节点从队列中清除
@@ -157,14 +151,11 @@
    */
   @SuppressWarnings("unused")
   public Node getLastNode(){
      //两个线程环境,需要同步锁
      synchronized(synObj) {
         Node node = this.tail.pre;
         if (node != this.head) {
            return node;
         }
         return null;
      Node node = this.tail.pre ;
      if(node != this.head){
         return node ;
      }
      return null ;
   }
   
   /**