Deprecated: Constant PDO::MYSQL_ATTR_USE_BUFFERED_QUERY is deprecated since 8.5, use Pdo\Mysql::ATTR_USE_BUFFERED_QUERY instead in /www/wwwroot/www.1998123.xyz/var/Typecho/Db/Adapter/Pdo/Mysql.php on line 71
admin 发布的文章 - 98123_学习与记录

admin 发布的文章

    public class Main {

    private static int THREAD_COUNT = 10;
    private static int ITEM_COUNT = 1000;

    private static ConcurrentHashMap<String, Long> getData(int count) {

return  LongStream.rangeClosed(1, count)
        .boxed().collect(Collectors.toConcurrentMap(i-> UUID.randomUUID().toString(), Function.identity(),(t1, t2)->t1,ConcurrentHashMap::new));
    }

    public static void main(String[] args) throws InterruptedException {
        ConcurrentHashMap<String, Long> stringLongConcurrentHashMap = getData(ITEM_COUNT-100);
        System.out.println("init siez:"+stringLongConcurrentHashMap.size());
        ForkJoinPool forkJoinPool = new ForkJoinPool(THREAD_COUNT);
        forkJoinPool.execute(()-> IntStream.rangeClosed(1,10).parallel().forEach(i->{
               

                int gap=ITEM_COUNT-stringLongConcurrentHashMap.size();
                System.out.println("gap siez:"+gap);

                stringLongConcurrentHashMap.putAll(getData(gap));

               
        }));
        forkJoinPool.shutdown();
        forkJoinPool.awaitTermination(1, TimeUnit.HOURS);
        System.out.println("finish siez:"+stringLongConcurrentHashMap.size());



    }
}

上面没添加锁输出以下结果

init siez:900
gap siez:100
gap siez:100
gap siez:100
gap siez:100
gap siez:100
gap siez:100
gap siez:100
gap siez:100
gap siez:100
gap siez:100
finish siez:1900

添加锁之后

public class Main {

    private static int THREAD_COUNT = 10;
    private static int ITEM_COUNT = 1000;

    private static ConcurrentHashMap<String, Long> getData(int count) {

return  LongStream.rangeClosed(1, count)
        .boxed().collect(Collectors.toConcurrentMap(i-> UUID.randomUUID().toString(), Function.identity(),(t1, t2)->t1,ConcurrentHashMap::new));
    }

    public static void main(String[] args) throws InterruptedException {
        ConcurrentHashMap<String, Long> stringLongConcurrentHashMap = getData(ITEM_COUNT-100);
        System.out.println("init siez:"+stringLongConcurrentHashMap.size());
        ForkJoinPool forkJoinPool = new ForkJoinPool(THREAD_COUNT);
        forkJoinPool.execute(()-> IntStream.rangeClosed(1,10).parallel().forEach(i->{
               synchronized (stringLongConcurrentHashMap){

                int gap=ITEM_COUNT-stringLongConcurrentHashMap.size();
                System.out.println("gap siez:"+gap);

                stringLongConcurrentHashMap.putAll(getData(gap));

               }
        }));
        forkJoinPool.shutdown();
        forkJoinPool.awaitTermination(1, TimeUnit.HOURS);
        System.out.println("finish siez:"+stringLongConcurrentHashMap.size());



    }
}

输出结果
init siez:900
gap siez:100
gap siez:0
gap siez:0
gap siez:0
gap siez:0
gap siez:0
gap siez:0
gap siez:0
gap siez:0
gap siez:0
finish siez:1000

分享几款免费docker面板

https://www.portainer.io/ 比较容易上手,也轻量,好多人推荐,有大佬做了汉化包 https://www.quchao.net/Portainer-CN.html
地址: http://demo.portainer.io/
用户名: admin
密码: tryportainer

https://rancher.com/ https://www.rancher.cn/ k8s据说功能强大,也重量级,中文

https://dockstation.io/ 看起来挺好的

https://cockpit-project.org/ 看起来挺好的,据说是 管理Linux 主机 顺便 管理docker

https://kitematic.com/docs/

https://github.com/qfdk/EasyDockerWeb 坛子里大佬适合单机docker可视化

https://www.dockernb.com/ DOCKER容器可视化管理系统

下表把 jpa 做的各种查询规范都列出来了。 如果要做其他相关查询,按照表格中的规范设计接口方法即可。


关键词 举例 生成的JPQL 语句片段
And findBy**Lastname**And**Firstname** … where x.lastname = ?1 and x.firstname = ?2
Or findBy**Lastname**Or**Firstname** … where x.lastname = ?1 or x.firstname = ?2
Is,Equals findBy**Firstname**,
findBy**Firstname**Is,
findBy**Firstname**Equals
… where x.firstname = ?1
Between findBy**StartDate**Between … where x.startDate between ?1 and ?2
LessThan findBy**Age**LessThan … where x.age < ?1
LessThanEqual findBy**Age**LessThanEqual … where x.age ⇐ ?1
GreaterThan findBy**Age**GreaterThan … where x.age > ?1
GreaterThanEqual findBy**Age**GreaterThanEqual … where x.age >= ?1
After findBy**StartDate**After … where x.startDate > ?1
Before findBy**StartDate**Before … where x.startDate < ?1
IsNull findBy**Age**IsNull … where x.age is null
IsNotNull,NotNull findBy**Age**(Is)NotNull … where x.age not null
Like findBy**Firstname**Like … where x.firstname like ?1
NotLike findBy**Firstname**NotLike … where x.firstname not like ?1
StartingWith findBy**Firstname**StartingWith … where x.firstname like ?1 (parameter bound with appended %)
EndingWith findBy**Firstname**EndingWith … where x.firstname like ?1 (parameter bound with prepended %)
Containing findBy**Firstname**Containing … where x.firstname like ?1 (parameter bound wrapped in %)
OrderBy findBy**Age**OrderBy**Lastname**Desc … where x.age = ?1 order by x.lastname desc
Not findBy**Lastname**Not … where x.lastname <> ?1
In findBy**Age**In(Collection ages) … where x.age in ?1
NotIn findBy**Age**NotIn(Collection age) … where x.age not in ?1
True findBy**Active**True() … where x.active = true
False findBy**Active**False() … where x.active = false
IgnoreCase findBy**Firstname**IgnoreCase … where UPPER(x.firstame) = UPPER(?1)

腾讯云的服务器会自动安装云监控、云镜等安全服务,方便在控制台查看产品运行状态等

可以看一下服务器的定时任务:

$ crontab -l

*/1 * * * * /usr/local/qcloud/stargate/admin/start.sh > /dev/null 2>&1 &

0 0 * * * /usr/local/qcloud/YunJing/YDCrontab.sh > /dev/null 2>&1 &

从来不看腾讯云的云监控控制台,要这东西有何用,卸载

云监控 Linux 安装目录是/usr/local/qcloud/stargate/usr/local/qcloud/monitor

还有一个主机安全,也就是所谓的云镜,新开服务器不取消勾选都会默认安装

云镜 Linux 安装目录是/usr/local/qcloud/YunJing

统统卸载!!!

直接在腾讯云服务器上运行以下代码

/usr/local/qcloud/stargate/admin/uninstall.sh
/usr/local/qcloud/YunJing/uninst.sh
/usr/local/qcloud/monitor/barad/admin/uninstall.sh

这些都是腾讯云自带的卸载脚本,如果你不想用也可以使用打包好的 shell

wget -qO- https://raw.githubusercontent.com/littleplus/TencentAgentRemove/master/remove.sh | bash

此脚本卸载完腾讯云的监控,但是腾讯云文件夹并不是只有监控,为了保险起见,脚本不会

rm -rf /usr/local/qcloud

,不作死就不会死
卸载完以后可以通过如下命令来查看是否卸载干净

ps -A | grep agent

如无任何输出,则已卸载干净,如果有输出,请检查是否你自己的程序