地图事件触发_使用地图触发功能处理相干事件

地图事件触发

本文介绍如何通过使用映射触发器来处理一致性事件。 基本上,建议使用Oracle Coherence中的分布式数据管理来研究Oracle Coherence API的基本配置和实现。
映射触发器是Oracle Coherence提供最高度定制的缓存管理系统的最重要功能之一。 MapTrigger表示一种功能代理,它允许针对基础地图进行验证,拒绝或修改变异操作。 此外,它们还可以防止无效事务,增强安全性,提供事件日志记录和审核以及收集有关数据修改的统计信息。

例如,我们有与NamedCache一起使用的代码,并且我们想要在将条目插入地图之前更改条目的行为或内容。 通过启用映射触发器,可以在不修改所有现有代码的情况下进行此更改。

有两种方法可以将“地图触发器”功能添加到应用程序:

1)一种MapTriggerListener可以使用具有指定的高速缓存来注册MapTrigger
2)可以在coherence-cache-config.xml配置文件中使用类工厂机制

在以下示例应用程序中,通过遵循第一种方法来实现MapTrigger功能。 创建了一个称为OTV的新集群,并通过在该集群的两个成员之间使用的用户映射NamedCache对象分发了User bean。

二手技术:

JDK 1.6.0_35
Spring3.1.2
连贯性3.7.1 Maven的3.0.2 步骤1:建立已完成的专案

创建一个Maven项目,如下所示。 (可以使用Maven或IDE插件创建)。



第2步:相干套餐

通过Coherence软件包下载Coherence

步骤3:图书馆

首先,将Spring依赖项添加到Maven的pom.xml中。

<!-- Spring 3.1.2 dependencies --><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>${spring.version}</version></dependency>

Coherence库是手动安装到Local Maven Repository的,其描述如下所示添加到pom.xml中。 另外,如果不使用Maven管理项目,则可以将coherence.jar文件添加到classpath中。

<!-- Coherence library(from local repository) --><dependency><groupId>com.tangosol</groupId><artifactId>coherence</artifactId><version>3.7.1</version></dependency>

为了创建runnable-jar ,可以使用以下Maven插件。

<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-shade-plugin</artifactId><version>1.3.1</version><executions><execution><phase>package</phase><goals><goal>shade</goal></goals><configuration><transformers><transformerimplementation='org.apache.maven.plugins.shade.resource.ManifestResourceTransformer'><mainClass>com.otv.exe.Application</mainClass></transformer><transformerimplementation='org.apache.maven.plugins.shade.resource.AppendingTransformer'><resource>META-INF/spring.handlers</resource></transformer><transformerimplementation='org.apache.maven.plugins.shade.resource.AppendingTransformer'><resource>META-INF/spring.schemas</resource></transformer></transformers></configuration></execution></executions></plugin>


步骤4:建立otv-coherence-cache-config.xml

第一个Coherence配置文件是otv-coherence-cache-config.xml 。 它包含(分布式或复制的)缓存方案和缓存方案映射配置。 创建的缓存配置应添加到coherence-cache-config.xml中

<?xml version='1.0'?><cache-config xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'xmlns='http://xmlns.oracle.com/coherence/coherence-cache-config'xsi:schemaLocation='http://xmlns.oracle.com/coherence/coherence-cache-configcoherence-cache-config.xsd'><caching-scheme-mapping><cache-mapping><cache-name>user-map</cache-name><scheme-name>MapDistCache</scheme-name></cache-mapping></caching-scheme-mapping><caching-schemes><distributed-scheme><scheme-name>MapDistCache</scheme-name><service-name>MapDistCache</service-name><backing-map-scheme><local-scheme><unit-calculator>BINARY</unit-calculator></local-scheme></backing-map-scheme><autostart>true</autostart></distributed-scheme></caching-schemes></cache-config>


步骤5:创建tangosol-coherence-override.xml

第二个Coherence配置文件是tangosol-coherence-override.xml 。 它包含集群,成员身份和可配置缓存工厂配置。

集群的第一个成员的tangosol-coherence-override.xml:

<?xml version='1.0'?><coherence xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'xmlns='http://xmlns.oracle.com/coherence/coherence-operational-config'xsi:schemaLocation='http://xmlns.oracle.com/coherence/coherence-operational-config coherence-operational-config.xsd'><cluster-config><member-identity><cluster-name>OTV</cluster-name><role-name>OTV1</role-name></member-identity><unicast-listener><well-known-addresses><socket-address id='1'><address>x.x.x.x</address><port>8089</port></socket-address><socket-address id='2'><address>x.x.x.x</address><port>8090</port></socket-address></well-known-addresses><machine-id>1001</machine-id><address>x.x.x.x</address><port>8089</port><port-auto-adjust>true</port-auto-adjust></unicast-listener></cluster-config><configurable-cache-factory-config><init-params><init-param><param-type>java.lang.String</param-type><param-value system-property='tangosol.coherence.cacheconfig'>otv-coherence-cache-config.xml</param-value></init-param></init-params></configurable-cache-factory-config></coherence>


集群的第二个成员的tangosol-coherence-override.xml:

<?xml version='1.0'?><coherence xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'xmlns='http://xmlns.oracle.com/coherence/coherence-operational-config'xsi:schemaLocation='http://xmlns.oracle.com/coherence/coherence-operational-config coherence-operational-config.xsd'><cluster-config><member-identity><cluster-name>OTV</cluster-name><role-name>OTV2</role-name></member-identity><unicast-listener>      <well-known-addresses><socket-address id='1'><address>x.x.x.x</address><port>8090</port></socket-address><socket-address id='2'><address>x.x.x.x</address><port>8089</port></socket-address></well-known-addresses><machine-id>1002</machine-id><address>x.x.x.x</address><port>8090</port><port-auto-adjust>true</port-auto-adjust></unicast-listener></cluster-config><configurable-cache-factory-config><init-params><init-param><param-type>java.lang.String</param-type><param-value system-property='tangosol.coherence.cacheconfig'>otv-coherence-cache-config.xml</param-value></init-param></init-params></configurable-cache-factory-config></coherence>


步骤6:创建applicationContext.xml

Spring配置文件applicationContext.xml已创建。

<beans xmlns='http://www.springframework.org/schema/beans'xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'xsi:schemaLocation='http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsd'><!-- Beans Declaration --><bean id='userCacheService' class='com.otv.srv.UserCacheService'></bean><bean id='userCacheUpdater' class='com.otv.exe.UserCacheUpdater'><property name='userCacheService' ref='userCacheService' /></bean></beans>


步骤7:创建用户分类

创建了一个新的User Spring bean。 该bean将分布在OTV集群中的两个节点之间。 对于序列化,已经实现了java.io.Serializable接口,但是可以实现PortableObject以获得更好的性能。

package com.otv.user;import java.io.Serializable;/*** User Bean** @author onlinetechvision.com* @since 29 Oct 2012* @version 1.0.0**/
public class User implements Serializable {private static final long serialVersionUID = -1963764656789800896L;private String id;private String name;private String surname;	public String getId() {return id;}public void setId(String id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getSurname() {return surname;}public void setSurname(String surname) {this.surname = surname;}@Overridepublic String toString() {StringBuilder strBuff = new StringBuilder();strBuff.append('id : ').append(id);strBuff.append(', name : ').append(name);strBuff.append(', surname : ').append(surname);return strBuff.toString();}
}


步骤8:建立IUserCacheService接口

为服务层创建了一个新的IUserCacheService接口,以公开缓存功能。

package com.otv.srv;import com.tangosol.net.NamedCache;/*** IUserCacheService Interface exposes User Cache operations** @author onlinetechvision.com* @since 29 Oct 2012* @version 1.0.0**/
public interface IUserCacheService {/*** Adds user entries to cache** @param Object key* @param Object value**/void addToUserCache(Object key, Object value);/*** Deletes user entries from cache** @param Object key**/void deleteFromUserCache(Object key);/*** Gets user cache** @retun NamedCache Coherence named cache*/NamedCache getUserCache();}


步骤9:创建UserCacheService IMPL类

通过实现IUserCacheService创建UserCacheService

package com.otv.srv;import com.otv.listener.UserMapListener;
import com.otv.trigger.UserMapTrigger;
import com.tangosol.net.CacheFactory;
import com.tangosol.net.NamedCache;
import com.tangosol.util.MapTriggerListener;/*** CacheService Class implements the ICacheService** @author onlinetechvision.com* @since 29 Oct 2012* @version 1.0.0**/
public class UserCacheService implements IUserCacheService {private NamedCache userCache = null;private static final String USER_MAP = 'user-map';private static final long   LOCK_TIMEOUT = -1;public UserCacheService() {setUserCache(CacheFactory.getCache(USER_MAP));getUserCache().addMapListener(new UserMapListener());getUserCache().addMapListener(new MapTriggerListener(new UserMapTrigger()));}	/*** Adds user entries to cache** @param Object key* @param Object value**/public void addToUserCache(Object key, Object value) {// key is lockedgetUserCache().lock(key, LOCK_TIMEOUT);try {// application logicgetUserCache().put(key, value);} finally {// key is unlockedgetUserCache().unlock(key);}}/*** Deletes user entries from cache** @param Object key**/public void deleteFromUserCache(Object key) {// key is lockedgetUserCache().lock(key, LOCK_TIMEOUT);try {// application logicgetUserCache().remove(key);} finally {// key is unlockedgetUserCache().unlock(key);}}/*** Gets user cache** @retun NamedCache Coherence named cache*/public NamedCache getUserCache() {return userCache;}public void setUserCache(NamedCache userCache) {this.userCache = userCache;}}


步骤10:创建UserMapTrigger类

通过实现com.tangosol.util.MapTrigger接口,可以创建一个新的UserMapTrigger类。 在将条目插入到用户映射中之前,此触发器将处理逻辑。

package com.otv.trigger;import org.apache.log4j.Logger;import com.otv.listener.UserMapListener;
import com.otv.user.User;
import com.tangosol.util.MapTrigger;/*** UserMapTrigger executes required logic before the operation is committed** @author onlinetechvision.com* @since 29 Oct 2012* @version 1.0.0**/
public class UserMapTrigger implements MapTrigger {private static final long serialVersionUID = 5411263646665358790L;private static Logger logger = Logger.getLogger(UserMapListener.class);/*** Processes user cache entries** @param MapTrigger.Entry entry**/public void process(MapTrigger.Entry entry) {User user = (User) entry.getValue();String id = user.getId();String name = user.getName();String updatedName = name.toUpperCase();String surname = user.getSurname();String updatedSurname = surname.toUpperCase();if (!updatedName.equals(name)) {user.setName(updatedName);}if (!updatedSurname.equals(surname)) {user.setSurname(updatedSurname);}user.setId(user.getName() + '_' + user.getSurname());entry.setValue(user);logger.debug('UserMapTrigger processes the entry before committing. '+ 'oldId : ' + id+ ', newId : ' + ((User)entry.getValue()).getId()+ ', oldName : ' + name+ ', newName : ' + ((User)entry.getValue()).getName()+ ', oldSurname : ' + surname+ ', newSurname : ' + ((User)entry.getValue()).getSurname());}public boolean equals(Object o) {return o != null && o.getClass() == this.getClass();}public int hashCode() {return getClass().getName().hashCode();}
}


步骤11:建立USERMAPLISTENER IMPL类别

创建一个新的UserMapListener类。 该侦听器接收分布式的用户映射事件。

package com.otv.listener;import org.apache.log4j.Logger;import com.tangosol.util.MapEvent;
import com.tangosol.util.MapListener;/*** UserMapListener Class listens user cache events** @author onlinetechvision.com* @since 29 Oct 2012* @version 1.0.0**/
public class UserMapListener implements MapListener {private static Logger logger = Logger.getLogger(UserMapListener.class);public void entryDeleted(MapEvent me) {logger.debug('Deleted Key = ' + me.getKey() + ', Value = ' + me.getOldValue());}public void entryInserted(MapEvent me) {logger.debug('Inserted Key = ' + me.getKey() + ', Value = ' + me.getNewValue());}public void entryUpdated(MapEvent me) {
//		logger.debug('Updated Key = ' + me.getKey() + ', New_Value = ' + me.getNewValue() + ', Old Value = ' + me.getOldValue());}
}


步骤12:创建CacheUpdater类

创建CacheUpdater类以添加新条目以缓存和监视缓存内容。

package com.otv.exe;import java.util.Collection;import org.apache.log4j.Logger;import com.otv.srv.IUserCacheService;
import com.otv.user.User;/*** CacheUpdater Class updates and prints user cache entries** @author onlinetechvision.com* @since 29 Oct 2012* @version 1.0.0**/
public class UserCacheUpdater implements Runnable {private static Logger logger = Logger.getLogger(UserCacheUpdater.class);private IUserCacheService userCacheService;/*** Runs the UserCacheUpdater Thread**/public void run() {		//New User are created...User user = new User();//Only Name and Surname properties are set and Id property will be set at trigger level.user.setName('James');user.setSurname('Joyce');//Entries are added to cache...getUserCacheService().addToUserCache('user1', user);//		The following code block shows the entry which will be inserted via second member of the cluster
//      so it should be opened and above code block should be commented-out before the project is built.//		user.setName('Thomas');
//		user.setSurname('Moore');
//		getUserCacheService().addToUserCache('user2', user);//Cache Entries are being printed...printCacheEntries();}/*** Prints User Cache Entries**/@SuppressWarnings('unchecked')private void printCacheEntries() {Collection<User> userCollection = null;try {while(true) {userCollection = (Collection<User>)getUserCacheService().getUserCache().values();for(User user : userCollection) {logger.debug('Cache Content : '+user);}Thread.sleep(60000);}} catch (InterruptedException e) {logger.error('CacheUpdater is interrupted!', e);}}public IUserCacheService getUserCacheService() {return userCacheService;}public void setUserCacheService(IUserCacheService userCacheService) {this.userCacheService = userCacheService;}
}


步骤13:创建应用程序类

创建应用程序类以运行应用程序。

package com.otv.exe;import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;/*** Application class starts the application** @author onlinetechvision.com* @since 29 Oct 2012* @version 1.0.0**/
public class Application {/*** Starts the application** @param  String[] args**/public static void main(String[] args) {ApplicationContext context = new ClassPathXmlApplicationContext('applicationContext.xml');UserCacheUpdater cacheUpdater = (UserCacheUpdater) context.getBean('userCacheUpdater');new Thread(cacheUpdater).start();}
}

nbsp;
步骤14:建立专案

在构建OTV_Spring_Coherence_MapTrigger项目之后,将创建OTV_Spring_Coherence_MapTrigger-0.0.1-SNAPSHOT.jar
重要说明:群集的成员具有不同的Coherence配置,因此应为每个成员分别构建项目。

步骤15:通过启动集群成员来运行项目

在集群成员上运行了OTV_Spring_Coherence-0.0.1-SNAPSHOT.jar文件后,以下输出日志将显示在第一个成员的控制台上:

--A new cluster is created and First Member joins the cluster and adds a new entry to the cache.
29.10.2012 18:26:44 DEBUG (UserMapTrigger.java:49) - UserMapTrigger processes the entry before committing. oldId : null, newId : JAMES_JOYCE
, oldName : James, newName : JAMES, oldSurname : Joyce, newSurname : JOYCE
29.10.2012 18:26:44 DEBUG (UserMapListener.java:25) - Inserted Key = user1, Value = id : JAMES_JOYCE, name : JAMES, surname : JOYCE
29.10.2012 18:26:44 DEBUG (UserCacheUpdater.java:63) - Cache Content : id : JAMES_JOYCE, name : JAMES, surname : JOYCE.......--Second Member joins the cluster and adds a new entry to the cache.
29.10.2012 18:27:33 DEBUG (UserMapTrigger.java:49) - UserMapTrigger processes the entry before committing. oldId : null, newId : THOMAS_MOORE,
oldName : Thomas, newName : THOMAS, oldSurname : Moore, newSurname : MOORE
29.10.2012 18:27:34 DEBUG (UserMapListener.java:25) - Inserted Key = user2, Value = id : THOMAS_MOORE, name : THOMAS, surname : MOORE.......--After second member adds a new entry, cache content is shown as below :
29.10.2012 18:27:44 DEBUG (UserCacheUpdater.java:63) - Cache Content : id : THOMAS_MOORE, name : THOMAS, surname : MOORE
29.10.2012 18:27:45 DEBUG (UserCacheUpdater.java:63) - Cache Content : id : JAMES_JOYCE, name : JAMES, surname : JOYCE
29.10.2012 18:28:45 DEBUG (UserCacheUpdater.java:63) - Cache Content : id : THOMAS_MOORE, name : THOMAS, surname : MOORE
29.10.2012 18:28:45 DEBUG (UserCacheUpdater.java:63) - Cache Content : id : JAMES_JOYCE, name : JAMES, surname : JOYCE

第二成员的控制台:

--After Second Member joins the cluster and adds a new entry to the cache, cache content is shown as below and the members has got same entries :.
29.10.2012 18:27:34 DEBUG (UserMapListener.java:25) - Inserted Key = user2, Value = id : THOMAS_MOORE, name : THOMAS, surname : MOORE
29.10.2012 18:27:34 DEBUG (UserCacheUpdater.java:63) - Cache Content : id : JAMES_JOYCE, name : JAMES, surname : JOYCE
29.10.2012 18:27:34 DEBUG (UserCacheUpdater.java:63) - Cache Content : id : THOMAS_MOORE, name : THOMAS, surname : MOORE
29.10.2012 18:28:34 DEBUG (UserCacheUpdater.java:63) - Cache Content : id : JAMES_JOYCE, name : JAMES, surname : JOYCE
29.10.2012 18:28:34 DEBUG (UserCacheUpdater.java:63) - Cache Content : id : THOMAS_MOORE, name : THOMAS, surname : MOORE


步骤16:下载

https://github.com/erenavsarogullari/OTV_Spring_Coherence_MapTrigger

参考: Online Technology Vision博客上的JCG合作伙伴 Eren Avsarogullari 使用地图触发功能进行的一致性事件处理 。

翻译自: https://www.javacodegeeks.com/2012/11/coherence-event-processing-by-using-map-trigger-feature.html

地图事件触发

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/351033.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

C++ 内存对齐

注&#xff1a;本文代码测试环境为win7 X64 cpu, 编译器为gcc4.7.1 和 vs2010 内存对齐是编译器为了便于CPU快速访问而采用的一项技术 我们先从一个例子开始&#xff0c;对下面的类(或者结构体) class node { char c; int i; short s; }no; sizeof(no)的值是多少呢&#xff0c;…

matlab sub2ind与ind2sub

sub2ind与ind2sub函数 A [1 2 3; 4 5 6;7,8,9]; >> fsub2ind(size(A), 2, 3) f 8 即把矩阵A中第二行第三列的元素的全下标标识&#xff08;2,3&#xff09;转换为对应的单下标标识8&#xff0c;即该元素从第一列顺次数过去是第八号元素。 而ind2sub则用于把矩阵中…

Spring Boot和Angular 2入门食谱

我主要是一名服务开发人员&#xff0c;必须不时创建一些可传递的UI。 我精通基于AngularJS1的基本UI&#xff0c;并且可以使用之前概述的方法来完成工作。 遗憾的是&#xff0c;随着Angular 2的出现&#xff0c;我不得不将以前的方法抛诸脑后&#xff0c;而现在使用Spring Boot…

Robbers' watch CodeForces - 685A (暴力)

大意: 一天n小时, m分钟, 表以7进制显示, 求表显示数字不同的方案数 注意到小时和分钟部分总长不超过7, 可以直接暴力枚举. 关键要特判0, 0的位数要当做1来处理 #include <iostream> #include <algorithm> #include <cstdio> #include <math.h> #inclu…

什么是javax.ws.rs.core.context? [第5部分]

如何使用Context批注 在什么是javax.ws.rs.core.context的第4部分中&#xff1f; 您学习了如何使用Context批注将HttpServletResponse和HttpServletRequest类注入资源方法。 在本文中&#xff0c;您将学习如何使用其余两个仅在servlet容器中可用的类&#xff0c;它们是&#x…

Linux字符界面和图形界面

Ubuntu图形界面和字符界面的切换 Ubuntu和其他的Linux系统一样&#xff0c;有图形界面和字符界面&#xff0c;同时能够设置默认的启动界面。 linux的显示界面分为命令行的字符界面和图形界面&#xff0c;我们可以设置linux的默认启动的显示界面。然后也可以手动的来回的切换。 …

matlab conv2

conv2函数----------------------------------------1、用法 1. Cconv2(A,B,shape); %卷积滤波 A:输入图像&#xff0c;B:卷积核 假设输入图像A大小为ma x na&#xff0c;卷积核B大小为mb x nb&#xff0c;则 当shapefull时&#xff0c;返回全部二维卷积结…

面试趣味题

题目&#xff1a;一元钱可以买到一瓶水,两个空瓶子可以换一瓶水,小明有20元钱,问最多可以喝多少瓶水? 在面试的时候做了一个这种逻辑题。当时只是要求写出最后的结果。没有要求用代码来实现。我下面准备先分析一下&#xff0c;然后再转换成代码去实现。 根据这个示意图可以简单…

mongodb 持久性_多语言持久性:带有MongoDB和Derby的EclipseLink

mongodb 持久性从现在开始&#xff0c;多语种持久性一直是新闻。 从2011年底开始&#xff0c;在著名的Fowler职位的激励下&#xff0c;我看到了更多更好的主意。 最新的一个是公司内部的学生项目&#xff0c;我们在其中使用Scala作为后端数据&#xff0c;将数据持久存储到Mongo…

linux 动态库文件stripped属性理解

在centos 6.2下用file命令查看文件信息的时候&#xff0c;显示如下&#xff1a; libcom_err.so.2: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped libcrypto.so.10: ELF 64-bit LSB shared object, x86-64, version 1 (SYS…

matlab gradient

gradient函数 >> x[6,9,3,4,0;5,4,1,2,5;6,7,7,8,0;7,8,9,10,0]x 6 9 3 4 0 5 4 1 2 5 6 7 7 8 0 7 8 9 10 0 >> [Fx,Fy]gradient(x) Fx 3.0000 -1.5000 -2.5000 -1.5000…

第六章 传输层

思维导图&#xff1a; 一、 概述 与数据链路层关系 提供可靠的、高效的、性价比高的数据传输输出实体 传输层利用网络层的服务&#xff0c;为它的上层应用层提供服务 网络层与传输层不同点&#xff1a; 网络层运行在由承运商操作的路由器上&#xff0c;因此用户无法真正控制到网…

Kanvas:从您的ANTLR语法生成一个简单的IDE

什么是编辑器&#xff1f; 对我来说&#xff0c;编辑器是我工作中使用的主要工具。 作为语言工程师&#xff0c;我创建新的语言&#xff0c;使用现有的语言&#xff0c;并且需要其他工具来使用它们。 我希望能够在一个定制的IDE中将所有这些黑客一起入侵&#xff0c;我可以为我…

函数名/函数地址/函数指针

转自&#xff1a;http://hi.baidu.com/%C6%BF%D6%D0%B5%C4%C5%AE%CE%D7/blog/item/387db9ddaa54d0a9cd1166fa.html 函数指针&#xff1a;1。指针变量 2。指针变量指向函数 这正如用指针变量可指向整型变量、字符型、数组一样。 在编译时&#xff0c;每一个函数都有一个入口地址…

matlab imaqhwinfo

使用imaqhwinfo函数&#xff0c;来获取电脑上安装的摄像头的名称&#xff0c;比如winvideo&#xff0c;之后可以利用imaqhwinfo(winvideo)来进一步获取设备ID等边信息&#xff0c;这在之后的视频流获取中会用到。获取设备ID之后&#xff08;比如ID为1&#xff09;&#xff0c;可…

第二次作业--熟悉使用工具

GIT地址 https://github.com/ForeveruxGIT用户名 Foreverux学号后五位 62117博客地址 https://www.cnblogs.com/JQloveJX/ 作业链接 https://edu.cnblogs.com/campus/xnsy/SoftwareEngineeringClass1/homework/2793声明&#xff1a;部分内容摘自ChildishChange Part 0. 背景 阿…

什么是javax.ws.rs.core.context? [ 第2部分 ]

如何使用Context批注 在什么是javax.ws.rs.core.context&#xff1f; 您学习了如何使用Context批注从HttpHeaders类的注入实例中检索HTTP标头信息&#xff0c;以及如何从UriInfo实例中检索URI信息&#xff0c;例如URI参数和变量。 在本文中&#xff0c;您将学习如何将Context批…

【题解】Luogu P2347 砝码称重

正经DP题解 一道非常好的背包练手题&#xff08; sto&#xff08;注&#xff1a;原思路来源 SLYZ_0120 的题解&#xff09;orz 开始这道题 1.输入六个数&#xff0c;存进数组中 2.初始化 f 数组为0。 f [ i ] 表示重量为 i 的情况是否出现过&#xff08;下面代码使用的是 int 数…

matlab 获取视频图像的信息

获取视频图像的信息可以通过get函数来获取&#xff0c;如get(vid)或者get(getselectedsource(vid))。使用set函数可以设置摄像头获取的图像的一些属性值&#xff0c;也可以直接使用结构数组的“点”来赋值&#xff0c;比如&#xff0c;要持续通过摄像头获取图像&#xff0c;则可…

tomcat使用ssl_使用SSL和Spring Security保护Tomcat应用程序的安全

tomcat使用ssl如果您看过我的上一个博客&#xff0c;您会知道我列出了Spring Security可以做的十件事 。 但是&#xff0c;在开始认真使用Spring Security之前&#xff0c;您真正要做的第一件事就是确保您的Web应用使用正确的传输协议&#xff0c;在这种情况下为HTTPS –毕竟&a…